Is that possible to compare the strings in regex with conditional operators(not in split type)
Asked
Active
Viewed 76 times
-2
-
2Could you give an example ? – vincrichaud Apr 25 '18 at 15:18
-
Your question is unclear. At least give some example inputs and desired outputs. – Zabuzard Apr 25 '18 at 15:19
-
I have Json like this, i need to compare value of first object with the oeprator , similarly for second object, if both are satisfied then i need to use conditional operator to match two objects, [{"operator":"<=","value":10,"conditionalOperator":"And"},{"operator":"=>","value":"25","conditionalOperator":null}] – harishhari302 Apr 25 '18 at 16:41
1 Answers
0
You can try this type of regex,
.*?(word1 word2 word3).*?\/\/\/.*?(?(1)\1)
Demo,,, in which the sub_string(\1, "word1 word2 word3")
is checked if it is included in former string
, and attempts to match the sub-string in the latter string
.
It's the ///
which used to sectionalize
(or delimit
) to the former and latter strings.

Thm Lee
- 1,236
- 1
- 9
- 12