Re: escape character in regex

Henrik Park <[email protected]>
Newsgroups gmane.comp.lang.perl.beginners
Message-ID <[email protected]>
Ken

Thanks for pointing out that.
I was asking this b/c I want to put regex in a variable and use it for 
matching.

such as this one in java/scala:

scala> val regex = """\w+\$\w+\$\w+""".r
val regex: scala.util.matching.Regex = \w+\$\w+\$\w+

scala> str
val res72: String = hello$world$buddy

scala> regex.matches(str)
val res73: Boolean = true


regards



Ken Slater wrote:
> Therefore, you need to escape the dollar sign ($) as follows:
>        my $delimiter = '\$';
> To indicate that you are using the dollar sign ($) as a character.

-- 
Simple Mail
https://simplemail.co.in/

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.