tags - Regex to capture also outer parts of html fragment -


the issue shown online https://regex101.com/r/wz9ox5/4

the subject string html fragment code tags. need regex pattern parts of string between text of code htaml elements. parts should contain code opening , closing tag too.

example subject pattern:

abc <code fsa='fdsa'>     lorem </code> bcd <code fsa='fdsa'>     ipsum </code> cde <code fsa='fdsa'>     quo vadis </code> desf 

my pattern this:

(<\/code>.*?<code[^>]*?>) 

but gets inner parts of string. possible create pattern outer parts of string too?

i mean aditional parts such

abc <code fsa='fdsa'> 

and

</code> defs 

thank you

solved: https://regex101.com/r/wz9ox5/6

((^|<\/code>).*?(<code[^>]*?>|$))/gs 

Comments

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -