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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -