SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    perfect = good enough peach's Avatar
    Join Date
    Jun 2004
    Location
    -Netherlands-
    Posts
    1,383
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    regex match jQuery selectors

    I'm doing some search and replace work to batch update some files and I need to replace this:

    $('#navbar > ul ul')
    with
    $(Drupal.settings.sooperfish.invoke)

    where the selector part navbar > ul ul can be any selector, restricted by that its only made up of lowercase letters and > . # signs.

    I'm doing seacrh and replace with notepad++ and from examples I think my regex for finding the first string should look something like this:

    \$\(\'\#[A-Z]\'\)

    Im not sure if all those characters need to escaped but adding and removing backslashes doesn't make this query succesful

  2. #2
    perfect = good enough peach's Avatar
    Join Date
    Jun 2004
    Location
    -Netherlands-
    Posts
    1,383
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Finally I made some regex that works:
    \$\('#[^\)]+\)\.

    this regex stuff looks incredibly difficult and strange in the beginning but I was able to make this with the help of this page: http://www.zytrax.com/tech/web/regex.htm after trying dozens of queries that didn't work.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •