これを説明する方法がわからないので、例:
xx_xx -> matches because of the underscore -> .*_.*
xx_t_xx -> dont want this to match as _t_ is an exception I want to ignore
xx_t_xx_xx -> matches as there is an underscore that is not part of the string _t_
xx_t_xx_t_xx -> no match
_t_ -> no match
_ -> match
_t__ -> match
したがって、文字列の一部でない限り、アンダースコアを一致させてください _t_
それは正規表現で行うことができますか?
最後に完了し、すべての条件を確認しました。正常に動作しますこれを試してください。任意の1文字を受け入れます。これは間違いなくあなたのために働くでしょう
^([^_]|(_t_))*_([^_]|(_t_))*$
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加