-1

Can somebody help me to understand this below regular expreesion in XSLT.

regexp:match(test-graph.api.example.com, '(?=CN).*\.(.*)(\.)(.*)(?<=com)', 'i')

What would be the output and how to interpret this regular expression.

Please let me know

user5458829
  • 173
  • 1
  • 2
  • 15

1 Answers1

-1

Is should be read this way:

(?=CN).*\.(.*)(\.)(.*)(?<=com)

explanation:

.* matches any character (except for line terminators)
    * Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\. matches the character . literally (case sensitive)
1st Capturing Group (.*)
.* matches any character (except for line terminators)
    * Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
2nd Capturing Group (\.)
\. matches the character . literally
3rd Capturing Group (.*)
.* matches any character (except for line terminators)
    * Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Positive Lookbehind (?<=com)
Assert that the Regex below matches
com matches the characters com literally 

The i modifiers means that the regex is case insentive.

Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142