lundi 5 août 2019

Match the either middle of a word or the entire word in regex

I want to match both proposition and the sit in the middle of the word. How can I do this with regex?

I know you can do something like ^(proposition|sit)$ but I'm wondering if there's a different way.

Here would be the allowed strings (not treated as a multiline entry):

proposition
sit

And here would be some disallowed strings also not treated as multiline entries:

Proposition
position
SIT
stuffit_archive.sit
proposition 65

I'm using an if statement in bash 3.2.57(1)-release under 10.11.6 El Capitan.

Aucun commentaire:

Enregistrer un commentaire