Easy way to capture text (sub-string) between two surrounding words/phrases (without using "splits")


Let's say you have the following text/string (or something similar):

 

 ... abcde 12345 fghij ...

 

If you need/want only to capture the value 12345 (without the surrounding spaces), one option is to use the "split" command. Doing so is totally viable, but not the most straight forward way (as it requires multiple steps). The most straightforward way would be to use the "find" (Advanced) Command and use a regular expression as follows:

 

 (?<=abcdes)(.*)(?=sfghij)

 

This will yield the desired result and capture only the enclosed value between the surrounding phrases/words/terms. Modify the expression to suit your data.


0 replies

Be the first to reply!

Reply