How can I extract a substring up to the first digit?

后端 未结 4 1133
名媛妹妹
名媛妹妹 2021-01-15 09:01

How can I find the first substring until I find the first digit?

Example:

my $string = \'AAAA_BBBB_12_13_14\' ;

Result expected: \'AAA

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-15 09:14

    perl -le '$string=q(AAAA_BBBB_12_13_14);$string=~m{(\D+)} and print $1'
    AAAA_BBBB_
    

提交回复
热议问题