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

Pattern uis giving error on thie regex: ^[ A-Za-z0-9_@./,#&+-]*$ #90

Open
dragondz opened this issue Apr 2, 2023 · 3 comments
Open

Comments

@dragondz
Copy link

dragondz commented Apr 2, 2023

Hi
I used a call to this input like that :

<txp:com_connect_text class="form-control" name="nom" label="nom" placeholder="Nom du 1er Responsable " required break="" pattern="^[ A-Za-z0-9_@./,#&+-]$"/>

The browswer dont comlained about the pattern but when submitted i got errors from the plugin :

Tag error: <txp:com_connect_text class="form-control" name="raison" label="raison" placeholder="Raison Sociale " required break="" pattern="[ A-Za-z0-9_@./,#&+-]"/> -> Warning: preg_match(): Unknown modifier ',' while parsing form inscription on page default

I tested the pattern on this live preg_match : https://www.phpliveregex.com/#tab-preg-match and there is no complain.

@dragondz
Copy link
Author

dragondz commented Apr 2, 2023

Hi

I changed the pattern to this :

^[ A-Za-z0-9_@.,#&+-]*$

And it worked, but i dont know why it compained about / maybe need to escape it ?

@dragondz
Copy link
Author

dragondz commented Apr 2, 2023

Ok i resolved it myself sorry to bother.

@Bloke
Copy link
Member

Bloke commented Apr 2, 2023

Usually, you specify a pattern with delimiters, which is probably why it worked when you added the dollar and caret. It might have thought the slash was a delimiter and thrown an error. So yeah usually you need to escape such things.

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

2 participants