regex help *solved* I was crazy

Cogman

Lifer
Sep 19, 2000
10,284
138
106
I don't know why, but regular expressions just confuse me.

Anyways, here is what I need. I have to check a string that needs to contain two items. It will look something like this

"Blah: da da da wh FAIL"
or
"Blah: da SUCCESS wh fa"

I need to see if the string contains both Blah and FAIL or SUCCESS. The thing is, the why I'm getting these strings is in such a fashon that I could have multiple fails, successes, and blahs (I'm getting several lines like the above, think of reading something from dmsg in linux).

I've tried this, but it fails
/Blah:.*FAIL/

These are perl regular expressions by the way.
 

Ka0t1x

Golden Member
Jan 23, 2004
1,724
0
71
Code:
/Blah:(.*)FAIL/

Not sure what the difference between perl and other forms of regex.. but... That's how I see it.. (missing paren, for any char repeating)
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
Code:
/Blah:(.*)FAIL/

Not sure what the difference between perl and other forms of regex.. but... That's how I see it.. (missing paren, for any char repeating)

[edit]Oh wow, I'm an idiot! :) lol. So, here is what I was doing wrong. I had while (!statement || !statement || !statement) I wanted while (!statement && !statement && !statement)[/edit]
 
Last edited:

Cogman

Lifer
Sep 19, 2000
10,284
138
106
Which is equal to !(statement || statement || statement) :p

:) quiet you, I'm just happy I figured it out eventually.

Its amazing how you can write 1000s of lines of code with standard logic and yet all the sudden your brain freezes and you swap ors and ands.