Hi there,
here is another one.
I have a .TXT-File only containing one line: TAG:timecode=02:12:34:23
I want to populate a Variable using $regext($read("%s_original_path%\Timecode.TAG"),"(\d+)") in populate variables node, but it only gives me the first two digits (in this case 02).
How can I retrieve all eight numbers for a string looking like 02123423 ?
Thanks in advance,
thomas
[solved] $Regext() for multiple numbers
[solved] $Regext() for multiple numbers
Last edited by ThomasM on Fri Jun 14, 2019 10:36 am, edited 1 time in total.
Re: $Regext() for multiple numbers
Hi Thomas!
"\d+" means "the first number in the string plus any following number" - it does not work for your case because ":" is not a number.
The following means: "start from = and take everything up to the line end ($)"
Notice that the parenthesis () are for defining that we do not want to include the = Symbol itself.
A common Special tipp: in regex i mostly use this sequence "START(.+?)END"... it means match anything between... E.g. for XML parsing:
cheers!
"\d+" means "the first number in the string plus any following number" - it does not work for your case because ":" is not a number.
The following means: "start from = and take everything up to the line end ($)"
Code: Select all
=(.+?)$
A common Special tipp: in regex i mostly use this sequence "START(.+?)END"... it means match anything between... E.g. for XML parsing:
Code: Select all
<tag>(.+?)</tag>
emcodem, wrapping since 2009 you got the rhyme?
Re: $Regext() for multiple numbers
Hello Thomas,
Well, emcodem was, as usual, quicker as I but you can also do with "classic" populate variable like this :
You will obtain only your number.
Cheers.
Benjamin
Well, emcodem was, as usual, quicker as I but you can also do with "classic" populate variable like this :
You will obtain only your number.
Cheers.
Benjamin
Re: $Regext() for multiple numbers
Take care, the "^" (when used in brackets) means do NOT match (otherwise it means start of line), so this regex means do not match numbers.
Sorry i did not see that the ":" should not be included in the result. This should do it:
Code: Select all
(\d+):(\d+):(\d+):(\d+)
emcodem
emcodem, wrapping since 2009 you got the rhyme?
Re: $Regext() for multiple numbers
Hi,
indeed that was inverted logic! Thanks for correcting!
Igor
indeed that was inverted logic! Thanks for correcting!
Igor
Re: $Regext() for multiple numbers
Hi all,
thank you for your help - helps here in the archive a lot reading out log-files.
@emcodem,
works***per***fect***ly. Thank you!
@Momocampo
Nice idea. I will have a look at these functions. Thanks!
@Jnaciev,
yeah - I tried that also and broke. But anyway - Thank you too!
all the best,
tom
thank you for your help - helps here in the archive a lot reading out log-files.
@emcodem,
works***per***fect***ly. Thank you!
@Momocampo
Nice idea. I will have a look at these functions. Thanks!
@Jnaciev,
yeah - I tried that also and broke. But anyway - Thank you too!
all the best,
tom