Skip to content

regular expression for accept hashtags #80

Closed
@Yum1962

Description

@Yum1962

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 ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions