正则表达式该行的结尾

时间:2018-02-01 09:26:21

标签: regex

首先是例子:

The car is blue
The house is yellow
Fish swim
The fire truck is red
This text should look like this after applying the regex.
The car is blue.
The house is yellow.
Fish swim
The fire truck is red.

所以我想用点替换以“the”开头的所有句子。 我怎样才能做到这一点?坐了好几个小时。 最好的问候

1 个答案:

答案 0 :(得分:0)

正则表达式用于模式匹配,而不是用于更新字符串。

要搜索以&#34开头的行;"你可以写这样的正则表达式:

^the ---这匹配"""字符串位于行的开头。

您可以使用任何一种语言找出字符串的最后一个字符。对于Ex:在javaScript中:str.slice(-1)其中str是你的字符串。

相关问题