6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

最後にマッチした文字より後ろの文字列を検索

Posted at

検索方法

検索に用いる正規表現

(?<=c)([^c]+$)

→「c」を「X」に変更すると、最後にマッチした「X」より後ろの文字列を検索する。


**例)^で検索する場合**
(?<=\^)([^\^]+$)
検索対象文字列 検索結果
abc^bcd^efg^hij hij
zzz (該当なし)
dddddddd^ddddd ddddd
^ggg ggg
xxx^ (該当なし)

1個目の^以降の文字列が欲しければ以下で取得する。

(?<=\^)(.*)
6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?