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

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

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -