Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

reserved characters

by sandy1028 (Sexton)
on Jun 08, 2009 at 08:46 UTC ( [id://769414] : perlquestion . print w/replies, xml ) Need Help??

sandy1028 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: reserved characters
by marto (Cardinal) on Jun 08, 2009 at 09:00 UTC

    Recently you have posted many times (>20) regarding regular expressions, again here you show no code or any effort you have made to do this yourself. Previous replies have pointed you towards the documentation.

    What are you having a problem with here? Since you post no code it looks like you are simply asking for someone to do this task for you. This site is not a code production service. See Corion's notes on problems solving in a previous reply to one of your posts.


Re: reserved characters
by Utilitarian (Vicar) on Jun 08, 2009 at 09:36 UTC
    • Read the documentation to see how to escape special characters.
    • Make sure you understand when characters do not need to be escaped, eg. in character classes.
    • Then write a regex to replace any of the characters except $ OR $ followed by a digit, with a space and if you captured a digit replace it also.
    Go on try it it's not that hard and it's quite satisfying when you work it out yourself.
Re: reserved characters
by Grey Fox (Chaplain) on Jun 08, 2009 at 13:57 UTC
    As well as the documentation referenced above, I have found a tool called My REGEX Tester very good for checking out and experimenting with REGEX.
    I have a link to it in Found new online Regex tool.
    Plus there is a nice website called Regular-Expressions Quickstart. This teaches all of the basics of REGEX.

    REGEX can be very useful, and easy to use if you just study up on some of the basics.

    -- Grey Fox
    "We are grey. We stand between the darkness and the light" B5
Re: reserved characters
by Porculus (Hermit) on Jun 08, 2009 at 21:33 UTC
    This reads like a classic XY problem. Why do you want to remove these characters? There may be a simpler solution, like quotemeta (if you're trying to safely interpolate user input into a regex) or parameterised queries (if you're trying to avoid SQL injections).