-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestRegex.pl
More file actions
33 lines (27 loc) · 778 Bytes
/
testRegex.pl
File metadata and controls
33 lines (27 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env perl
#===============================================================================
#
# FILE: testRegex.pl
#
# USAGE: ./testRegex.pl
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Ye Zhao Liang (YZL), yezhaoliang@ncepu.edu.cn
# ORGANIZATION: NCEPU
# VERSION: 1.0
# CREATED: 2018/8/29 9:02:49
# REVISION: ---
#===============================================================================
use strict;
use warnings;
use utf8;
my $source="I have a string: 34.5 then -34.5 , also -34.5E6 or -34.56e6, finally 34.5E+10 or 34.5E-10";
while ( $source =~ m/(\-?\d+(\.\d+)?([e|E][+|-]?\d+)?)/xgm ) {
print "$1\n";
}
print $_,"\n" foreach split / /,$source;