Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从此字符串中获取“文本”:
{L[text]}
?
我试过
\{L\[*\]\}
但它不起作用。
缺少允许的字符类:
\{L\[(\w*)\]\}
其中 \w = [a-zA-Z0-9]。必需的文本在第 1 组中。
演示
您是否尝试过以下表达式?
/\{L\[([^\]]*)\]\}/
<?php $s = "{L[hello you]}"; preg_match('/\{L\[(.*)\]\}/', $s, $matches); print_r($matches);