Question Rodrigo Werneck · Mar 20, 2018

Bad regex?

Set rm=##class(%Regex.Matcher).%New("[0-9]*","Word 123456")
Write rm.ReplaceAll(".")
.W.o.r.d. ..

Why??

Comments

Timothy Leavitt · Mar 20, 2018

What are you trying to do? This?

USER>Set rm=##class(%Regex.Matcher).%New("[0-9]","Word 123456")

USER>Write rm.ReplaceAll(".")
Word ......

Or:

USER>Set rm=##class(%Regex.Matcher).%New("[0-9]+","Word 123456")

USER>Write rm.ReplaceAll(".")
Word .
0
Rodrigo Werneck  Mar 20, 2018 to Timothy Leavitt

Sorry, [0-9]+ indeed (I was testing with GNU grep -o with '*' and results are the same).

Thanks

0