#1#http://test.ir:8080/srvSC.svc#1#
#2#http://test.ir:8081/srvSC.svc#2#
#3#http://test.ir:8082/srvSC.svc#3#
#4#http://test.ir:8083/srvSC.svc#4#
#5#http://test.ir:8084/srvSC.svc#5#
#6#http://test.ir:8085/srvSC.svc#6#
我想选择所有#1# #2# ...
所以为了我写这个表达式:^(^\#.\#)
但它只是选择第一行。我怎么能选择第一个#.#
和#.#
的最后?
您可以使用
^(#\d+#)(.+)\1$
这将捕获组中的第一个#
s,重复任何字符,然后匹配第一组中匹配的相同字符。您想要的字符串将位于第二个捕获的组中。