Global Regex Module enables the site builders or developers to add regular expression based validations globally on any custom D7 text field or custom text fields created with drupal form api.
With the help of this module regular expressions can be added and changed globally.
Sandbox :
https://www.drupal.org/sandbox/neelamchaudhary/2673038
Git instructions:
git clone -b 7.x-1.x http://git.drupal.org/sandbox/neelam.chaudhary/2673038.git global_regex
cd global_regex
Manual reviews of other projects:
1. https://www.drupal.org/node/2680145#comment-10937315
2. https://www.drupal.org/node/2677542#comment-10937279
3. https://www.drupal.org/node/2674728#comment-10895528
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | 2673038.git-pareview.sh_.png | 251.97 KB | durgeshs |
| #19 | Screen Shot 2016-02-26 at 2.41.01 PM.png | 32.66 KB | manjit.singh |
| #15 | Screen Shot 2016-02-26 at 2.23.37 pm.png | 27.87 KB | zeeshan_khan |
| #14 | Screen Shot 2016-02-26 at 2.19.08 pm.png | 45.1 KB | zeeshan_khan |
Comments
Comment #2
neelam.chaudhary commentedComment #3
PA robot commentedGit clone failed for http://git.drupal.org/sandbox/neelamchaudhary/2673038.git while invoking http://pareview.sh/pareview/httpgitdrupalorgsandboxneelamchaudhary267303...
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
neelam.chaudhary commentedComment #5
neelam.chaudhary commentedComment #6
neelam.chaudhary commentedComment #7
neelam.chaudhary commentedComment #8
manjit.singhPlease add your manual review of project applications. Check https://www.drupal.org/node/1975228 , It will speed up your project application review.
Comment #9
zeeshan_khan commentedReview of the 7.x-1.x branch (commit bf99058):
Edit: removed long pareview.sh dump.
Comment #10
zeeshan_khan commentedComment #11
zeeshan_khan commentedComment #12
neelam.chaudhary commentedFixed all the code formatting issues.
Comment #13
manjit.singhPlease add your manual reviews till then.
Comment #14
zeeshan_khan commentedThanks for fixing pareview errors, However I have found one potential issue in coder.

Comment #15
zeeshan_khan commentedI also see this notice when creating or editing a cck field.
Comment #16
neelam.chaudhary commentedFixed both the errors.
Comment #17
zeeshan_khan commentedLooks good to me!
Thanks for the hard work @neelam.chaudhary
Comment #18
manjit.singhManual Review
$form['name']infunction global_regex_add_formis not properly sanitized. If I enter<script>alert('XSS');</script>in the name field of admin settings, I will get a nasty javascript popup. You need to sanitize user provided text before printing, Please check https://www.drupal.org/node/28984 and https://api.drupal.org/api/drupal/includes%21common.inc/group/sanitizati... . Also check the screenshot.Please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #19
manjit.singhForget to attach screenshot.
Comment #20
manjit.singhForget about README.txt, I had not pulled the latest code base.
Comment #21
neelam.chaudhary commentedThanks Manjit for reviewing the issue.
I have updated the code with the
check_plainto render the user provided text. Can you please review the code again.Comment #22
joachim commentedThis looks like it duplicates https://www.drupal.org/project/fapi_validation
Comment #23
neelam.chaudhary commentedThanks joachim for comment. fapi_validation provides form api validators for form fields so for applying regex with fapi_validation validation rules need to be created with code and in form_builder_functions or form_alter these rules need to be added.
And with global regex regex based validations on text fields created with CCK can be applied without implementing form_alter and regex based validation rules can be created without any coding only with admin forms. Additionally these rules can be used in code as well.
So the idea is to manage regex based validations through admin form and apply same regex based validations globally.
So i think this is no duplicate of fapi_valiation.
Comment #24
klausiGit errors:
manual review:
The wrong usage of check_plain() is a blocker right now.
As far as I can see there was a security issue because global_regex_list() does not filter $type->name, which is the human readable name that can contain dangerous characters. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Removing review bonus tag, no review comments linked in the issue summary. Make sure to read through the source code of the other projects, as requested on the review bonus page.
Comment #25
joachim commented> And with global regex regex based validations on text fields created with CCK can be applied without implementing form_alter and regex based validation rules can be created without any coding only with admin forms. Additionally these rules can be used in code as well.
So what you're saying is that fapi_validation is an API, aimed at developers, whereas your module offers a UI for site builders?
Maybe then it would be a good idea to have your module build on top of fapi_validation. fapi_validation already supports regexes, as well as lots of other validation rules, and is extensible to provide other rules, and works with https://www.drupal.org/project/clientside_validation. Building a UI on top of that would provide more value overall to the Drupal ecosystem.
Comment #26
neelam.chaudhary commentedComment #27
neelam.chaudhary commentedThanks klausi for the review.
I have added default banch for this project.
As per your feedback on below mentioned points:
1. project name: The regex in not local to a field, here regex is being applied to multiple fields with regex being defined only once so project name is global_regex. Moreover is field_global_regex fine?
2. Have added difference with fapi_validation on project page.
3. Use of CCK has been removed from project page.
4. global_regex_add_form(): use of node_type_load() has been removed.
5. global_regex_add_form() is not theme function for rendering form array. This is callback for constructing form array which is being rendered from drupal_get_form in menu callback and global_regex_list() has been removed.
6. check_plain() has been removed from submit function.
Comment #28
neelam.chaudhary commentedThanks joachim for suggestion.
FAPI validation works in a different way by proving API for field validations with the help of rules being defined in FAPI.
FAPI is a heavy module and provides lots of functionality which is not required by Global Regex.
Building Global Regex on top of FAPI would add unnecessary dependency on FAPI.
Comment #29
manjit.singhPlease add this tag when you adding the manual code reviews.
Comment #30
neelam.chaudhary commentedComment #31
durgeshs commentedGit default branch is not set.
Please check below for more information:
http://pareview.sh/pareview/httpgitdrupalorgsandboxneelamchaudhary267303...
Comment #32
durgeshs commentedI have checked code at http://pareview.sh/pareview/httpgitdrupalorgsandboxneelamchaudhary267303... and found some issue as per Drupal coding standards (please check the Drupal coding standards).
Please check attached file (2673038.git-pareview.sh_.png) also.
Comment #33
neelam.chaudhary commentedThanks Durgesh for review.
I have fixed the issues please review.
Comment #34
durgeshs commentedThanks @Neelam.
I have reviewed code as per 'Drupal coding standards'. These code are fine and also reviewed functionality for this module.
Module working fine :)
Comment #35
klausimanual review:
Otherwise looks good to me.
Thanks for your contribution, Neelam!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #36
neelam.chaudhary commentedThanks klausi for review and approving the module.
I have removed st from install file and have added autoloader in hook_menu.
I have corrected the docblock for hook_field_attach_validate.
Serial id in hook_schema is for displaying the id on regex types listing page for admin, and for giving sorting option as well with the serial id field as displaying machine name in listing was not looking good to me.
Thanks to all the reviewers for reviewing the module.
Comment #37
neelam.chaudhary commentedComment #38
neelam.chaudhary commented