Regular expressions acquired in brackets

https://blog.csdn.net/genius_yym/article/details/79670035

JS regular expression access to content within the parentheses in brackets braces

var STR = "XXXX 123 {456} [I] 789 123 [your] 456 (1389090) 789" ;

var regex1 = /\((.+?)\)/g;    // () parentheses 
var regex2 = /\[(.+?)\]/g;    // [] brackets 
var regex3 = / \ { (.? +) \} / G;   // {} braces, braces

// output is an array 
console.log (str.match (regex1));
console.log(str.match(regex2));
console.log(str.match(regex3));

JAVA

regex = "(?<=\\[)(\\S+)(?=\\])"

Guess you like

Origin www.cnblogs.com/dianzan/p/12034280.html