开发者

Regular Expression to match any string between the delimiters

Trying to match a strings in notepad++ with a regular expression.

The string I'm trying to match is formatted like this:

^*^1st Choice Housing. Inc~*~

The carets and tildes serve as the delimiters around the name.

Here's the regular expression I'm trying to use to match any string between the delimiters

\^\*\^([A-Za-z0-9-.]+)\~\*\~

Notepad++ says 0 matches. What is wrong with my regular expression?

If I use:

开发者_JS百科\^\*\^1st Choice Housing. Inc\~\*\~

It matches.


\^\*\^([ A-Za-z0-9.-]+)\~\*\~

You were missing a space, I added it at the beginning. And I rearranged your regex a bit and put - at the end, so there won't be any confusion about it possibly meaning a separation of a range of characters, such as A-Z.


\^\*\^([A-Za-z0-9-. ]+)\~\*\~

This includes the space you were lacking.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜