I'm trying to match a line in a textfile with
if [[ ${regel} =~ ([\s][CN][G]{2}[A]{2}[T]) ]];
I also tried instead of /s to use /A and /b couple examples of things I tried:
if [[ ${regel} =~ (\A[CN][G]{2}[A]{2}[T]) ]];
if [[ ${regel} =~ (\b[CN][G]{2}[A]{2}[T]) ]];
if [[ ${regel} =~ ([\A][CN][G]{2}[A]{2}[T]) ]];
if [[ ${regel} =~ ([\b][CN][G]{2}[A]{2}[T]) ]];
All of these match to nothing, if I remove the first one to just make
if [[ ${regel} =~ ([CN][G]{2}[A]{2}[T]) ]];
it will match what i wanted to match to but I want it to match to the space in front so it does not take mid line strings with it aswell.
Example of what a match looks like how I want it:
OZBMN6HH1KI CGGAATGGGGGGGGGGGGGGGCGAGAATCTGAAATAGAGTGGTGACGTGCTGCGTTGACATAGGTCCTAGGGACCACCAG
What am I doing wrong? How can I make it match ␣CGGAAT
?
\s
comes from Perl, it matches "any whitespace character", similar to[[:space:]]
(though it appears it's not exactly the same).[[:space:]]
of course matches not just space, but tabs (and some less common whitespace) too. – ilkkachu Nov 10 '18 at 12:45