Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex - multiline matching
#1
Hi,

i want to find capture the text between "merge" and "replace". I tried different combos but I can't get it to work.

Here's my text

DO NOT MERGE THE FILES do this to each one individually
REPLACE

Here's are the regex matching patterns that I've tried

;merge.+?replace

;merge.*?replace

;merge(.*)replace

Here's the code I tried using

Code:
Copy      Help
if(0=findrx(s pattern 0 1|4|8 list_of_1_section)) end "not found"

i made used the flags: insensitive, find all, and multi-line but I keep getting "no match found"

Please help.
#2
need option (?s)
#3
Thank you! You saved me again.
#4
Uh oh, something went wrong. That code above worked when there was one match, but would erroneously grab all the text when I created test data that had multiple matches. See test data below. I already set it to save matches to an array and include multiple matches.

I'm not sure what else I need to do.

Code:
Copy      Help
1. SECTION: 5A.

2. SUGGESTED SECTION: None.

3. NAME: The "Use Odd Numbers".



2. SUGGESTED SECTION: 1111111111.

3. NAME: 56464g56df4gdf56g4df56g4564


2. SUGGESTED SECTION: 333333333333333.

3. NAME: 57856756767
#5
Hi Gintaras,

I'm following up since I haven't heard back. I could really use your help.


Forum Jump:


Users browsing this thread: 2 Guest(s)