perl - Regex pattern concatenation -


is possible somehow concatenate this:

my $ pattern1 = qr/^/; 

with this:

my $ pattern2 = qr/abc/ 

so (the value of) this?

qr/^abc/ 

the syntax different, want achieve result.

you can concatenate regular expressions easily:

say /$pattern1$pattern2/ 'abc', 'xabc'; 

to increase readability, can use /x modifier , add space:

say / $pattern1 $pattern2 /x qw( abc xabc ); 

note scalars written without space after $ sigil.


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

php - Improving script execution time -

How to provide Authorization & Authentication using Asp.net, C#? -