を使用して線または何ものマッチ開始:私は設定ファイルに次のようしている正規表現
property = 10
#property = 10
#this is a test for #property
#this is a test for property
そして、私は最初の2例に一致するように正規表現を思い付くしようとしている:
#property.*|^property.*
そして、これが結果です::
property = 10 //this one
#property = 10 //and this one
#this is a test for #property
#this is a test for property
これまでのところ、私がやったことだった
私は他の変形を試してみましたが、最悪の結果の変更:
^#property.*|^property.*
[^\s]#property.*|^property.*
はここで私が使用しているオンライン正規表現のリンクです:
https://regex101.com/r/K2tm75/2
私はgrepコマンドでこの正規表現をbashスクリプトの一部として使用します。
regexにタグを付けるかどうかを尋ねる推奨がありました。言語にもタグを付ける方が良いでしょう。 –