-2

Is that possible to compare the strings in regex with conditional operators(not in split type)

GBlodgett
  • 12,704
  • 4
  • 31
  • 45
harishhari302
  • 61
  • 1
  • 4
  • 2
    Could 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 Answers1

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