Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regualr Expression Help (substring search)
#4
Code:
Copy      Help
str text="RED   626.217102   820.000000   461.000000   64.519341   2636.535645   447119.000000";;sameple string to be fed in by prior code

str pattern="\d{1,6}\.\d{6}";; regular expression pattern

Between 1 and 6 digits followed by a decimal point followed by exactly 6 digits

Between 1 and 6: {1,6}
digits: \d
followed by a decimal point: \. - note that since the decimal point is a metacharacter with special meaning in RegEx that must put a \ in front of it to denote it as a "literal" decimal point

followed by exactly 6 digits: \d{6}

I am an absolute beginner at this and half the time it's only by trial and error that I get one that works but I thought I would share what I know. If there are any suggestions or improvements (or mistakes) I am making, please feel free to let me know.

I intend to read some of the resources on the internet that have exercises one can do to get the logic and tricks of RegEx down. Any good suggestions would be appreciated.






[/b]


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)