Find a value before a LF or before a space

(imported topic written by jeremytoo)

I’m dealing with a text file that may contain my values in an arbitrary order.

Here are four valid potential lines:

password requisite pam_pwcheck.so minlen=7 remember=5

password requisite pam_pwcheck.so remember=5 minlen=7

password requisite pam_pwcheck.so minlen=7 remember=12

password requisite pam_pwcheck.so remember=12 minlen=7

If I use this relevance:

preceding text of first " " of (following text of first “remember=” of (lines whose (it contains regex “^password.*requisite” ) of file “/tmp/test.txt”))

it works on #2 and #4. If I try:

(following text of first “remember=” of (lines whose (it contains regex “^password.*requisite.*remember” ) of file “/tmp/test.txt”))

it works great on #1 and #3, but gets extraneous data on #2 and #4.

What’s the easiest way to say “before the first space, or, if there is no space, just take the value” ?

I know that I can do an if-then statement to see if there are spaces or characters after the remember clause, but this is a tiny piece of some already horrifically complex relevance, and I’m trying to keep it from getting any more unreadable.

(imported comment written by Bill.Ehardt)

Haven’t really done regex with bigfix yet, so I can’t tell if you can do lookbehind but what about something like this?

following texts of firsts “=” of first matches (regex “remember=\S*”) of lines whose (it contains regex “^password.*requisite”) of file “c:\test.txt”

(imported comment written by jeremytoo)

That, my good sir, is absolutely brilliant.

It works beautifully. Thank you!