Jump to content
Sign in to follow this  
Qousio

Stringregexp question...

Recommended Posts

Qousio

Hello!

I need to stringregexp a string that looks like this: value1: |01.23|

Soo, I have used this StringRegExp($text, 'value1: \V\d\d\V\d\d', 1)

And it works fine, the problem is, sometimes theres one number instead of two, so its |0.1|, in that case the above doesnt work.

Using strinlen to find out how many numbers there are wouldnt work either, because it could be 00.1 or 0.11 etc.

Edited by Qousio

Share this post


Link to post
Share on other sites
MrMitchell

There are other ways, but you could just replace the second \d with {1,2}.

StringRegExp($text, 'value1: \V\d{1,2}\V\d{1,2}', 1)

Something like that

Share this post


Link to post
Share on other sites
Qousio

There are other ways, but you could just replace the second \d with {1,2}.

StringRegExp($text, 'value1: \V\d{1,2}\V\d{1,2}', 1)

Something like that

Thanks allot, works perfectly :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.