0
Using regular expression, I would like to capture only the value within a tag:
<txt_conarq_assunto></txt_conarq_assunto>
Example:
Entree:
<txt_conarq_assunto>A classificar</txt_conarq_assunto>
Exit:
Classify
0
Using regular expression, I would like to capture only the value within a tag:
<txt_conarq_assunto></txt_conarq_assunto>
Example:
Entree:
<txt_conarq_assunto>A classificar</txt_conarq_assunto>
Exit:
Classify
2
You can use this expression:
(?s)(?<=\<txt_conarq_assunto>)(.*?)(?=\<\/txt_conarq_assunto\>)
Functional example: https://regex101.com/r/JUaJDj/1
2
You can use /<txt_conarq_assunto>(.+?)<\/txt_conarq_assunto>/
See the example below, with javascript
var texto = "<txt_conarq_assunto>A classificar</txt_conarq_assunto>";
var m = texto.match( /<txt_conarq_assunto>(.+?)<\/txt_conarq_assunto>/ );
console.log(m[1]);
2
use the pattern <[tag]>(.*?)</[tag]>
to get content between elements. Replace [tag] with the real element from which you want to extract content
var texto = "<txt_conarq_assunto>A classificar</txt_conarq_assunto>";
texto.replace(/<txt_conarq_assunto>(.*?)<\/txt_conarq_assunto>/g, function(match, g1) { console.log(g1); });
Browser other questions tagged regex
You are not signed in. Login or sign up in order to post.