Rather than stripping all special characters, you can simply match the required character, and that would be smaller regex.
You can use this:
/^[a-zA-Z0-9$,"']+$/
More Related Contents:
- Slice an url with regex – php [closed]
- need regex for youku video id [closed]
- Regex plus vs star difference? [duplicate]
- How do I find all YouTube video ids in a string using a regex?
- Delimiter must not be alphanumeric or backslash and preg_match
- php Replacing multiple spaces with a single space [duplicate]
- PHP Regex: How to match \r and \n without using [\r\n]?
- PHP Regex to check date is in YYYY-MM-DD format
- Need a good regex to convert URLs to links but leave existing links alone
- file_get_contents not working?
- Validating Crontab Entries with PHP
- PHP regular expression – filter number only
- Unknown modifier ‘/’ error in PHP [duplicate]
- ffmpeg Progress Bar – Encoding Percentage in PHP
- Find JSON strings in a string
- laravel trailing Slashes redirect to localhost
- How to find a whole word in a string in PHP without accidental matches?
- How to remove square brackets and anything between them with a regex?
- Regex for names with special characters (Unicode)
- How to get all captures of subgroup matches with preg_match_all()? [duplicate]
- How to replace all XHTML/HTML line breaks () with new lines?
- How can I validate regex?
- Regular expression for a string that must contain minimum 14 characters, where at minimum 2 are numbers, and at minimum 6 are letters
- Youtube I.D parsing for new URL formats
- PHP and regexp to accept only Greek characters in form
- How to validate that a string only contain lowercase letters?
- Regular expression: find range except for one letter or a range
- How to get the shortest rather than longest possible regex match with preg_match()
- Regex to match an IP address [closed]
- PHP’s preg_replace regex that matches multiple lines