I want to remove part of string using start and end words in string. At the same i want to keep number appear in this range.
String:
<FORMAT=T>8</FORMAT><FORMAT=ty>45</FORMAT>
Regex:
/(<FORMAT=T>).[^<FORMAT]*(<\/FORMAT>)/gm
output
<FORMAT=ty>45</FORMAT>
Expected output: I want keep number appear in between <FORMAT=T>...</FORMAT>
8<FORMAT=ty>45</FORMAT>
It looks like you want substitution (search/replace):
<FORMAT=T>(\d+)</FORMAT>where the number between the tags is captured.\dmay need to be[0-9]in some regex engines.\1or$1depending on your regex engine.Demo