Java中的正则表达式不清楚

时间:2015-03-22 21:01:49

标签: java regex string

x=x.replaceFirst("(?<=^.)\\S+", ".")

我在程序中发现了这个,我不明白这是做什么的。有人可以向我解释一下吗?

1 个答案:

答案 0 :(得分:2)

除了第一个字母外,它基本上修剪了第一个单词。 这是它的描述:

(?<=^.) Positive Lookbehind - assert that the regex below can be matched

   ^ assert position at start of the string

   . matches any character (except newline)

\\S  match any non-white space character ( not like [\r\n\t\f ])

   +    between one and unlimited times

您可以阅读说明here

相关问题