I am considering the following options:
' !This is a string! '
'!This is a string !'
'! This is a string !'
' ! This is a string! '
' ! This is a string '
For each of these scenarios, I aim to find a match for:
'This is a string'
Here's what I have attempted so far:
/\s*!(.*)!{0,1}
/\s*!(.*?)!{0,1}
However, it seems to either include the !
or not match at all. Keep in mind that the trailing !
is optional.