简体   繁体   中英

Sed regex does not work

The following command does not return anything and i think my regex is good ?

echo 'The.Big.Bang.Theory.S07E01.VOSTFR.720p.WEB-DL.DD5.1.H.264-GKS.mkv' |\
sed -n '/The.Big.Bang.Theory*VOSTFR*720p*WEB-DL*.mkv/p'

Thanks!

  • \\. matches the . char
  • .* matches any char zero or more times:

    sed -n '/The\\.Big\\.Bang\\.Theory.*VOSTFR.*720p.*WEB-DL.*\\.mkv/p'

y* means zero or more y s. R* means zero or more R s. etc.

You probably want

/The\.Big\.Bang\.Theory.*VOSTFR*720p.*WEB-DL.*\.mkv/

Works like this :

echo 'The.Big.Bang.Theory.S07E01.VOSTFR.720p.WEB-DL.DD5.1.H.264-GKS.mkv' |\
sed -n '/The.Big.Bang.Theory.*VOSTFR.*720p.*WEB-DL.*.mkv/p'

I forgot the dots :/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM