Regex for between "> and <"something else

Discussion in 'Questions' started by jcknick, Apr 19, 2017.

  1. jcknick

    jcknick Client

    Joined:
    May 10, 2013
    Messages:
    95
    Likes Received:
    2
    Hi guys,

    this isn't the first time, I'm running into this.

    I need to select the shortest match between:

    "> and <"and a few more elements here and there

    But every time I'm trying to run it, I get the whole thing up to head tag :-)

    How do I escape the "> so that it picks up what I need?

    I tried stackoverflow.com, but I'm guessing the question is too easy for them :-)

    Thanks in advance..
     
  2. sMax

    sMax Client

    Joined:
    May 4, 2011
    Messages:
    116
    Likes Received:
    41
    Last edited: Apr 19, 2017
  3. jcknick

    jcknick Client

    Joined:
    May 10, 2013
    Messages:
    95
    Likes Received:
    2
    Here's what I'm trying to do:

    [​IMG]

    As you can see it's picking up a ton of redundant code up to the <head> tag... instead of expected result:

    Kit Contains: Caressing Body Sorbet (350ml) Mineral Hand Cream (100ml) Mineral Botanic Velvet Cream Wash - Lotus &amp; Chestnut (85ml)

    Problem is that the devs on site messed up their inline styling, and it would make more sense for me to just grab everything between > and <something else>, than try and figure out inline css for each item.

    I hope I managed to explain myself a bit better...
     
  4. sMax

    sMax Client

    Joined:
    May 4, 2011
    Messages:
    116
    Likes Received:
    41
    OK,
    yous screenshot does not show data, so I can't tell.
    but your "Before search text:" is too short , it selects everything between the first tag ending with "> and the end selection.
    It is the same difference between my first image and the second, it has to be more specific, a longer more distinct pattern needs to be selected. You have not given the example source, so that is all I can say.
     
  5. jcknick

    jcknick Client

    Joined:
    May 10, 2013
    Messages:
    95
    Likes Received:
    2
    Hey, thanks for the reply, funny that I was expecting that the "Shortest match" checkbox in regex builder looks for shortest matches between specified characters, without being picky :-) I will try to extend the before code, but it would be nice if the builder would be more exact on the input specifications. Or is there a general limitation in regex syntax?
     
  6. sMax

    sMax Client

    Joined:
    May 4, 2011
    Messages:
    116
    Likes Received:
    41
    It actually does.... what ZP version are you using?
    Because the current regexp editor does not escape things I see escaped on your screenprint (like the "). Maybe there is an issue there. It should have started taking after the .js">
    What uis before the head? , you can pm some of the source if you like.
     

Пользователи просматривающие тему (Пользователей: 0, Гостей: 0)