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.
我有一个字符串要查找:[general_options] 并使用了这个 exp: (\[.*])in netbeans
(\[.*])
但是它找到了带有括号的整个 [....] 字符串,我只需要里面的内容:general_options,怎么做?
要么你改变你的捕获组
\[(.*)]
并从捕获组 1 中获取您的结果(假设这是唯一的一个)
或者您使用后向和前瞻断言(如果它们受支持)
(?<=\[).*(?=])