Can I have a little help with my field validation? I want to restrict one of my fields to a list (of arbitrary length) of posts on my forum, separated by spaces, but the following doesn't seem to work:
regex:/^(((\Qhttps://\E){0,1})(\Qforumlink/d/\E)([0-9])+-.+?\/([0-9])+( )*)+/
(replacing "forumlink" with the actual address of my forum, e.g. discuss.flarum.org
)
This is what I'm trying to go for:
- optionally match
https://
- match
forumlink/d/
- match
(at least one number)-(a minimal number of any characters)
to catch the thread name and number
- match
/(at least one number)
to get the post number
- match any number of spaces to separate the links (including zero in case this is the last link)
- and finally match that entire previous expression at least one time, to allow for an unlimited number of links.
When I pull the regex from this and put it into https://regex101.com/ it successfully matches a list of links from my forum, but when I put the whole thing into the validation field and attempt to make a new post with that same list of links in the field, it tells me the field is invalid. I'm not sure if my problem here is the regex or the format of my laravel validation rule (which I am otherwise completely unfamiliar with).