[英]Postgres Regex: extract string after the last occurence of the pattern and the end of line
[英]How to extract a substring after last occurence of an integer in a string
如何根据字符串中的最后一个整数从字符串中提取子字符串。 例如,如果我有以下字符串
$my string = "_ZN7romcode6B0_rom3addEjj";
并且我想在最后一个整数之后获得子字符串,即在这种情况下为3。 我如何使用perl regex轻松完成它。
我会做:
my $string = "_ZN7romcode6B0_rom3addEjj";
my ($end) = $string =~ /(\D+)$/;
\\D
代表不是数字的任何字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.