Nathan
(Nathan Smith)
1
How do we create an OR condition in regex where in it should return true either of the condition is met for example
System.Text.RegularExpressions.Regex.IsMatch(data,"^sampleregexhere1") | System.Text.RegularExpressions.Regex.IsMatch(data,"^sampleregexhere2")
if any of the following is met it should only return 1 value which either true or false. Is that possible ? Thanks
1 Like
regex = “pattern1|pattern2”
Nathan
(Nathan Smith)
4
would that work in an IsMatch?
Nathan
(Nathan Smith)
6
no its not I tried
System.Text.RegularExpressions.Regex.IsMatch(data,"^sampleregexhere1") | System.Text.RegularExpressions.Regex.IsMatch(data,"^sampleregexhere2")
@Nathan - Are you looking something like this??

2 Likes
Nathan
(Nathan Smith)
8
yeah but result is boolean @prasath17
2 regex expression
Nathan
(Nathan Smith)
9
using System.Text.RegularExpressions.Regex.IsMatch
@Nathan - please give your sample text with variation and the expected result…
2 Likes
system
(system)
Closed
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.