This is my string
<search>1</search> <search>4</search> <search>2</search> <search>5</search> <search>3</search> <search>6</search>
I have the following rex command rex field=a_field "<search>(?<TESTING>(.?))</search>"
This will only grab TESTING=1. I want to grab all the values.
Using the rex command rex field=a_field "<search>(?<TESTING>.*)</search>"
will grab everything in-between, including the brackets and search string.
How would I make sure that I only grab the values between the bracketed strings?
max_match:
| rex field=foo max_match=99 ....
Unless I'm misunderstanding the question
Additionally, take a look at non-greedy matching in regex. This will greedily match everything until the last closing tag:
<search>(?<TESTING>.*)</search>
While this will non-greedily match only the bit until the first closing tag:
<search>(?<TESTING>.*?)</search>
Note the question mark after the asterisk.
Perfect! Thank you for this parameter for the rex command.