Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex POSIX ERE(扩展正则表达式)中的正向查找或非捕获组_Regex_Awk_Regex Lookarounds_Capturing Group_Lookaround - Fatal编程技术网

Regex POSIX ERE(扩展正则表达式)中的正向查找或非捕获组

Regex POSIX ERE(扩展正则表达式)中的正向查找或非捕获组,regex,awk,regex-lookarounds,capturing-group,lookaround,Regex,Awk,Regex Lookarounds,Capturing Group,Lookaround,在CSV文件中,有与此类似的行: <iframe src="https://player.vimeo.com/video/30342373" width="640" height="364" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 正在捕获:vimeo.com/video/30342373 如果我知道的没错,mawk只支持POSIX ERE语法,

在CSV文件中,有与此类似的行:

<iframe src="https://player.vimeo.com/video/30342373" width="640" height="364" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
正在捕获:
vimeo.com/video/30342373

如果我知道的没错,
mawk
只支持POSIX ERE语法,这类似于
egrep


如何仅从行中捕获唯一的视频id部分?

使用
sed更容易:

str='<iframe src="https://player.vimeo.com/video/30342373" width="640" height="364" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'

sed 's~.*\.vimeo\.com/video/~~; s~" .*~~' <<< "$str"

30342373
str=''

sed的~.\.vimeo\.com/video/~;s~“*~”使用
sed更容易:

str='<iframe src="https://player.vimeo.com/video/30342373" width="640" height="364" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'

sed 's~.*\.vimeo\.com/video/~~; s~" .*~~' <<< "$str"

30342373
str=''
sed的~.\.vimeo\.com/video/~;s~“*~”
$ awk '{gsub(/.*vimeo.com\/video\/|".*/,"")}1' file
30342373