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 with (?: exp), can't init DPLRegularExpression #128

Open
ruoyuruoshui opened this issue May 16, 2017 · 2 comments
Open

Comments

@ruoyuruoshui
Copy link

app[-]*[a-zA-Z]*.(?:nextev|nio).com/content/:contentId

This is my regular expression for march url, but after method stringByRemovingNamedGroupsFromString , it's modifiedStr is ^app[-]*[a-zA-Z]*.(?|nio).com/content/([^/]+)$.

@chrismaddern
Copy link
Contributor

Hi @ruoyuruoshui -- ? is a reserved character in regex so your regex is invalid (you can always check here -- https://regex101.com/)

You need to escape your ? --> \\?

Hope that helps!

@ruoyuruoshui
Copy link
Author

@chrismaddern (?:nextev|nio) is a group that match nextv or nio but not remember the match result. but method namedGroupTokensForString had match ':nextev' and remove it. I had try to modify DPLNamedGroupComponentPattern = @"?<!\\?):[a-zA-Z0-9-_][^/]+" to ignore ?:exp expression , and it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants