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

Named group added for the safer 'protected patterns' recognition regexp #168

Merged
merged 3 commits into from Dec 23, 2016

Conversation

tofula
Copy link
Contributor

@tofula tofula commented Oct 31, 2016

In the original code there are the number references used , which might actualy colidate if any group is used inside the $protected_pattern string. for example the protected_pattenr (loaded from file ) : (http[s]?|ftp)://[^:\/\s]+(/\w+)*/[\w-.]+.

If we use the number reference, the $2 will reffer to (http[s]?|ftp):, instead to (.) inside the :
while ($t =~ /($protected_pattern)(.
)$/) {

Naming patterns resolves this issue.

In the original code there are the number references used , which might actualy colidate if any group is used inside the $protected_pattern string.  for example the protected_pattenr (loaded from file ) :  (http[s]?|ftp):\/\/[^:\/\s]+(\/\w+)*\/[\w\-\.]+.

If we use the number reference, the $2 will reffer to (http[s]?|ftp):, instead to  (.*) inside the :
 while ($t =~ /($protected_pattern)(.*)$/) {

Naming patterns resolves this issue.
@hieuhoang hieuhoang merged commit 59119c0 into moses-smt:master Dec 23, 2016
@hieuhoang
Copy link
Contributor

thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants