Regular:
\[A-za-z]{2,}.1cws\ The text I want to catch is bold: http: // SomeAdress / SomeAdress / ws / Testws .1cws? Wsdl
Regular:
\[A-za-z]{2,}.1cws\ The text I want to catch is bold: http: // SomeAdress / SomeAdress / ws / Testws .1cws? Wsdl
With the help of advanced and retrospective verification, you can achieve what you want:
/(?<=\/)([A-za-z]{2,})(?=.1cws)/ (?<=\/) - checks if the / character is found before the specified expression.(?=.1cws) - checks if the character set .1cws occurs after the specified expression.
View an example of work: https://regex101.com/r/0Nv9gh/1 .
It will work in languages with PCRE support. In JS there is no retrospective verification.
Expressions inside the forward and retrospective test are not captured in the result set. You can read more about these checks in the article " Leading and Retrospective Checks in Regular Expressions ".
Since JS does not support retrospective checks, you can capture the characters of interest into a separate group and work with it already:
/\/([A-za-z]{2,}).1cws/ View an example of work: https://regex101.com/r/josgHv/1 .
To solve my question, you need to add a "positive look-ahead" construction to the end of the template.
Note: look-behind expressions are not supported in some implementations, for example in javascript
[A-za-z]{2,})(?=.1cws) Source: https://ru.stackoverflow.com/questions/614302/
All Articles