[英]Get strings inside four brackets (regex)
How i can write something like this: 我怎么写这样的东西:
var s = "[hello world](one two)";
var x = s.replace(REGEX, '<p>$1</p><b>$2</b>');
output: 输出:
<p>hello world</p><b>one two</b>
console.log( "[hello world](one two)".replace(/\\[(.*)\\]\\((.*)\\)/, '<p>$1</p><b>$2</b>'));
\n
Use the following regex with negated character class . 使用以下带有否定字符类的正则表达式。
var s = "[hello world](one two)"; var x = s.replace(/\\[([^\\]]*)]\\(([^)]*)\\)/, '<p>$1</p><b>$2</b>'); console.log(x);
使用带有regex.exec(string)和this(([。 ])|((。 )))+(或类似于此的东西)的捕获组并构建theputut字符串
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.