Repository navigation
Expand file tree
/
Copy pathregex.pl
More file actions
executable file
·81 lines (70 loc) · 1.38 KB
/
Copy pathregex.pl
File metadata and controls
executable file
·81 lines (70 loc) · 1.38 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/perl
# sub regex {
# while (<>) {
#
# if (/^(quit|exit|stop)$/i) {
# exit;
# }
# }
# }
# ®ex;
# sub regex1 {
#
# $text = "Here is Chait";
# $text =~ s/\w+\s\w+/There was/;
# print "$text\n";
#
# $htmltext = "<IMG>Arsenal is the Best</IMG>";
# if ($htmltext =~ /<(\w+)>[\w\s.]+<\/\1>/i) {
# print "Anchor Found: $1\n"; }
# }
# ®ex1;
# sub digit {
#
# while($digit=<>) {
# if ($digit =~ /^[\d]+$/) {
# print "Yes this is a number: $digit\n";
# }
# }
# }
# &digit;
# sub count {
## Print count of matches found and replace with /s
# $text = "Hey Duuuuude";
# print ($text =~ s/u/w/g) . print "\n";
# print "$text\n";
# }
# &count;
# sub dupe {
# ##Replace Duplicate repeated Characters.
# $text = "shilllppaa";
# $text =~ tr/[a-z]//s;
# print "$text\n";
# }
# &dupe;
# sub ucase {
# # replace lowercase string with Upper Case
# $text = "arsenal";
# $text =~ s/(\w+)/uc($1)/ge;
# print "$text\n";
# }
# &ucase;
sub blank {
# removing Blank Spaces before and after
$text = " Now is the time to win Arsenal. ";
$text =~ s/^\s+|\s+$//g;
print "$text\n";
}
␣
# sub look_ahead {
# # Look Ahead expressions.
# # $& holds last match; $` holds string behind last match; $' holds string ahead of last match.
# $text = "Alexis Ozil Giroud ";
# while ($text =~ /\w+(?=\s)/g) {
# # body...
# print "$&\n";
# #print "$`\n";
# #print "$'\n";
# }
# }
# &look_ahead;