Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regular expression for accept hashtags #80

Closed
Yum1962 opened this issue Apr 14, 2024 · 1 comment
Closed

regular expression for accept hashtags #80

Yum1962 opened this issue Apr 14, 2024 · 1 comment

Comments

@Yum1962
Copy link

Yum1962 commented Apr 14, 2024

Hello everyone, I'm having an issue with my regular expression. How can I make it accept the use of hashtags without compromising security? I'm trying to implement this regular expression, but whenever I attempt, I receive an error.

My code

'patterns' => [
// Allow only hashtags
'#(?<![[:alnum:]])#\w+#',

// Add your other patterns for protection against XSS below:
// Evil starting attributes
'#(<[^>]+[\x00-\x20\"\'\/])(form|formaction|on\w*|style|xmlns|xlink:href)[^>]*>?#iUu',

// javascript:, livescript:, vbscript:, mocha: protocols
'!((java|live|vb)script|mocha|feed|data):(\w)*!iUu',
'#-moz-binding[\x00-\x20]*:#u',

// Unneeded tags
'#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base|img)[^>]*>?#i'

],

any idea to solve this?

Error preg_match(): Unknown modifier ''

@Yum1962
Copy link
Author

Yum1962 commented Apr 14, 2024

Solved

@Yum1962 Yum1962 closed this as completed Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant