Regex (Kem) question(solved)

Value i use in the regex.

(?:clipDistance=\\D)(\\d++)\\D

Then i use SeString2 to change the numbers.
if Match <> Nil then
SeString1 =Match.SubExpressionString(0)
SeString2 =val(Match.SubExpressionString(1))
end

clipDistance="4000000" clipDistance="1000" clipDistance="40000" clipDistance="1e+007" <<--- i get only the first "1e"
Is possible to implant as SubExpressionString for the clipDistance="1e+007" ?
Or if is NOT possible as SubExpressionString to take it with code(\d++)\D[/code]

Let me break down the expression as posted:

code[/code] A non-capturing group that looks for the string “clipDistance” followed by “=” and a single character that is not a digit.

code[/code] A capturing group that looks for a series of digits possessively ("++").

\\D A single non-digit.

If this is what you intended, I can see why it’s working as described. The “1” matches the second condition and the “e” matches the last. However, if you know the text will always be between quotes, why not use that as your delimiter? Something like…

clipDistance="(-?\\d[^"]*)

I added an optional negative sign in front of the first number, so this pattern looks for “clipDistance=” followed by a quote, an optional negative, at least one digit, then anything that is not a quote. It captures what’s between the quotes. (There is no need to capture the last quote unless you want to validate the text too.)

Let me know if I’ve made incorrect assumptions.

Yes you have right.
The numbers,etc is always inside quotes,so the clipDistance="(-?\d[^"]*) is perfect for me.
Still trying to learn the regex :smiley:
Thank you Kem :wink: