开发者

Regular expression to modify a line that contains only a single word at the start

I have a text file in which any line that star开发者_StackOverflow中文版ts with a single word and has no other characters after that should be enclosed inside caret characters.

For example, a line that contains only the following 6 characters (plus the newline):

France

should be replaced with a line that consists of only the following 8 characters (plus the newline):

^France^

Is there a Regular Expression I could use in the Find/Replace feature of my text editor (Jedit) to make these modifications to the file?


Regex to find lines with a single word:

^(\w+)$

replace with:

^$1^
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜