Consulting

Results 1 to 2 of 2

Thread: Solved: Regex to collect data after a search term and before the first of two others

  1. #1

    Solved: Regex to collect data after a search term and before the first of two others

    I need to fashion a regex with the following requirements:

    SEARCH_TERM_#1(.*)SEARCH-TERM_#2_OR_#3

    So the regex should collect data between SEARCH_TERM_#1 and SEARCH_TERM_#2 or #3 WITHOUT including the search terms, AND it should choose as the 'right-side' search border whatever it finds first of #2 and #3.

    To be specific I need the collected data start after 'style="background-image: url(' and stop BEFORE either '&cfs=1' or '\);"' which ever comes first (the search terms without the quotes '...') My problem is that regex machine captures '&cfs=1' and stops before '\);"' although '&cfs=1' comes before '\);"' . I'm using PowerGrep with the command 'collect data'.

    Thanks, all comments are welcome.

  2. #2
    I've got the answer (all credit to a user at stackover.com)

    The regex which does the above described task is (among others I assume):

    [VBA]^.*?SEARCH_TERM_\#1((??!SEARCH-TERM_\#2|SEARCH-TERM_\#3).)*)[/VBA]

Posting Permissions

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