hi! i want to match a word to a regex while using a variable. i tried with<|$s..|> (s is my variable) but it doesn't recognize s.. and so i used Regex.glob("$s") but i'm not quite sure what other regex symbols to use.. what symbols are valid in the string? *? .? thanks!!
alex_panchenkoThu 31 May 2012
If you want to create regex from string then Regex(s)
shoshThu 31 May 2012
but i want my string to begin with whatever is in s (can i use ^?) and then any string can trail. such as: "^$s*" how do i do that?
alex_panchenkoThu 31 May 2012
Regex("^" + s + ".*") or Regex("^${s}.*")
shoshThu 31 May 2012
are you sure the ^ symbol means starts with? i tried it but it didn't find a match.
shosh Thu 31 May 2012
hi! i want to match a word to a regex while using a variable. i tried with<|$s..|> (s is my variable) but it doesn't recognize s.. and so i used Regex.glob("$s") but i'm not quite sure what other regex symbols to use.. what symbols are valid in the string?
*
?.
? thanks!!alex_panchenko Thu 31 May 2012
If you want to create regex from string then
Regex(s)
shosh Thu 31 May 2012
but i want my string to begin with whatever is in s (can i use
^
?) and then any string can trail. such as: "^$s*" how do i do that?alex_panchenko Thu 31 May 2012
Regex("^" + s + ".*")
orRegex("^${s}.*")
shosh Thu 31 May 2012
are you sure the
^
symbol meansstarts with
? i tried it but it didn't find a match.SlimerDude Thu 31 May 2012
The www.regular-expressions.info website seems to think so.