Perl regex: How do you match multiple words in perl? -


I am writing a small script that should match all the strings in another file (the words "" and " "" And "symbol" also).

The regex statement is currently being used, although it only generates results for '. () *' and ". () * " my @string_matches = ($ file_string = ~ /'(.*) ''" (. *) "/ G); print" \ n @ String_match ";

How can I include" "or" symbols "in the results? (Print" string "instead of just the string) I try to search online But no content can be found on it

$ file_string is basically a string version of an entire file.

Use this: '(. *?)' | "

It seems that the greedy operator returns your string to the last '. Use this regex to lazy

IMHO:

  [']] [^' '] * ?   

This will also solve the problem of not getting quotes inside your match.

Demo here: < / Html>

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -