In a simple regex I want to match segments where "1 is not followed by 'a', possibly preceded by whitespaces", '1' may be followed by a nonword character (such as ",").
(在一个简单的正则表达式中,我要匹配以下段:“ 1后面不跟'a',可能后面跟空格”,'1'后面跟一个非单词字符(例如“,”)。)
1\W(?!\s a) functions correctly (on test strings "1 a" and "1, a") 1\W?(?!\s a) does not function correctly.
(1 \ W(?!\ s a)正常运行(在测试字符串“ 1 a”和“ 1,a”上)1 \ W?(?!\ s a)正常运行。)
What is the explanation for this?(这有什么解释?)
ask by TonyR translate from so