Reputation: 3262
I have the following text pattern,
os2v some text openssl-56 test Is Not founded
and need to extract the word before "test Is Not founded", i.e., in this case: openssl-56
Currently I've tried to use this regular expression:
if (m/os2v (\s+) test is NOT founded/i){
print $1
}
But why does the code not enter the if statement?
Upvotes: 0
Views: 122
Reputation: 12586
The problem is that you don't get a match since your pattern is incorrect. The following pattern would match and extract openssl-56
for you:
(\S+)(?=\stest Is Not founded)
Upvotes: 1
Reputation: 943537
The obvious problems are that your text doesn't include the word "Update" and \s
will match whitespace.
Upvotes: 3