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

Update regex docs to encourage named regex groups #447 #699

Merged
merged 2 commits into from
Oct 22, 2018

Conversation

wlung
Copy link
Contributor

@wlung wlung commented Oct 20, 2018

Description

  • Updated the Message Object Additional Parameters with a section about Named Groups.
  • Edited some grammar, mostly adding in commas, to improve clarity while reading.

Fixes #447

Status

READY | UNDER DEVELOPMENT | ON HOLD

Type of change

Please delete options that are not relevant.

  • Documentation (fix or adds documentation)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

  • N/A

Checklist:

  • I have performed a self-review of my own code
  • [x ] I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@codecov
Copy link

codecov bot commented Oct 20, 2018

Codecov Report

Merging #699 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #699   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          24     24           
  Lines        1522   1522           
=====================================
  Hits         1522   1522

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d41a0a...9ddcb15. Read the comment docs.

Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for raising this!

The groups section is great and is exactly what I was after.

I really appreciate you fixing grammar and adding commas. Could I ask you to have another look over them though as I feel you may have sprinked a few too many around. Specifically see my comments.

If you can just make those tweaks I will get this merged.

@@ -92,11 +92,39 @@ async def remember(opsdroid, config, message):
await message.respond("OK I'll remember that")
```

### Named Groups

Elaborate regular expressions may use many groups, both to capture substrings of interest, as well as to group and structure the regular expression itself. In complex regular expressions, it can become difficult to keep track of the various groups and become unecessarily complex to include multiple groups if you refer to them by their index. Instead, give the groups names to make it easier to keep track of the different groups and retrieve them later.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command in ... complex regular expressions, feels weird. I recommend removing it and breaking the sentence into two.


If a skill is configured with both the regex and some other NLU matcher then users who don't use NLU will get a simple regex match. However users with some other NLU configured will get matches on more flexible messages, but will not see duplicate responses where the regex also matched.
If a skill is configured with both the regex and some other NLU matcher, users who don't use NLU will get a simple regex match. However, users with some other NLU configured will get matches on more flexible messages, but they will not see duplicate responses where the regex also matched.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure about how correct the commas are.

wlung added a commit to wlung/opsdroid that referenced this pull request Oct 21, 2018
removed unnecessary commas in response to feedback given in PR opsdroid#699
@wlung
Copy link
Contributor Author

wlung commented Oct 22, 2018

I made changes based on your feedback and committed them. I see the commit when I click on the Commits tab at the top of this page. Do I need to do more to get the changes reflected in this PR? I'm still pretty new to open source contributing, so I'm not certain that I've done this right.

@jacobtomlinson
Copy link
Member

Nope you've done everything right! Many thanks for this.

Also welcome to open source and welcome to opsdroid. Great to have you.
Ping me your address via DM on Twitter or Gitter and I'll post you some opsdroid stickers!

@jacobtomlinson jacobtomlinson merged commit dfbb20c into opsdroid:master Oct 22, 2018
FabioRosado pushed a commit to FabioRosado/opsdroid that referenced this pull request Dec 18, 2018
…oid#699)

* Update to encourage named regex groups

* Updated Named Groups and commas
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.

2 participants