Regular Expression help?

I need a regular expression for:

[0000] Status

If the zero padded number between the square brackets is non zero then it is a match.
So if the number is >0 and <65535 then its a match.

Keeeeeeem?!!!

He’s the man! If he can’t do it no one can!

\\[(?=0*[1-9])\\d+\\]

That will match square brackets that contain a non-zero value.

Is it as simple as:

\\[((?!0000)\\d+)\\] (.*)

Capture 1 = Number
Capture 2 = Status

If you know that the number will be exactly 4 digits.

0000, 0001…65535
So yes 4 digits left padded with 0s.
Thanks Kem… :slight_smile: and jeremy…

[quote=185001:@Brian O’Brien]0000, 0001…65535
So yes 4 digits left padded with 0s.[/quote]
Count again :wink:

0xFFFF is 65536… 5 digits.
Doh!

but I think kens code doesn’t care… any number of none 0 characters is satisfied.

egrep: repetition-operator operand invalid

Testing at the command line…

What is it I’m not understanding about ‘regex’ are there different versions and the one that egrep uses in my shell different from the one within Xojo?

Could very well be, or there could be a switch to recognize more advanced tokens. In either case, test it either in a tool like RegExRX or within Xojo itself.

I use RegExRx for every regular expression pattern match verification or not :wink: It also has a mini library of regex commands to use with brief descriptions. Its very helpful and matches my Xojo PCRE results.
Its the best $5 you will ever spend.
https://itunes.apple.com/us/app/regexrx/id498370702?mt=12

[quote=185122:@Mike Cotrone]I use RegExRx for every regular expression pattern match verification or not :wink: It also has a mini library of regex commands to use with brief descriptions. Its very helpful and matches my Xojo PCRE results.
Its the best $5 you will ever spend.
https://itunes.apple.com/us/app/regexrx/id498370702?mt=12[/quote]

Even if you only use it a few times. Plus, you’re supporting one of the locals here who is so free with helping everyone, especially with RegEx’s… Kem.

[quote=185122:@Mike Cotrone]I use RegExRx for every regular expression pattern match verification or not :wink: It also has a mini library of regex commands to use with brief descriptions. Its very helpful and matches my Xojo PCRE results.
Its the best $5 you will ever spend.
https://itunes.apple.com/us/app/regexrx/id498370702?mt=12[/quote]

I have been doing RegExs for over 20 years now, especially PCRE/Perl RegEx. And I use the hell out of RegExEx to quickly validate and tweak my RegEx code.

The best resource I’ve ever found for learning about regex’s is Mastering Regular Expressions by Jeffrey E. F. Friedl.

Thanks — just joined the club and bought RegExRx too!