ryoryo
(Ryosei Egawa)
June 27, 2018, 2:03am
1
Hi, my Regex code below doesn’t work but could not found the problem…
Is way of using “Regex” wrong?
var hoge (datatable)
row(0){“I like an apple very much”,“Bob”}
var piyo (datatable)
row(0){“apple”,“expensive”}
if
(condition)
System.Text.RegularExpressions.Regex.IsMatch(piyo(0)(0).ToString, “(.)(hoge(0)(0).ToString)(. )” )
ture
message box “it works!”
false
//do nothing
sarathi125
(Parthasarathi)
June 27, 2018, 5:48am
2
Hi,
Check this link, you can test your regex expression by passing values to it.
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
evangemert
(Erik van Gemert)
June 27, 2018, 8:00am
3
Looks like you’re actually looking to match (. )(hoge(0)(0).ToString)(. ) at the moment. If you want to pass variables into the pattern I think you should change it to:
System.Text.RegularExpressions.Regex.IsMatch(piyo(0)(0).ToString, “(.)(“+hoge(0)(0).ToString+”)(.)” )
I’m not 100% sure if that works, you can also try making a new string variable called ‘pattern’ and assigning “(.)(“+hoge(0)(0).ToString+”)(.)” to it.