Clarifiy regex in docs
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 58/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, php
- Domain
- documentation
Research direction
Read the regex matcher documentation and compare its examples with the new RegExp() behavior described in the issue. Clarify whether regex values need delimiters and how the examples are interpreted; the issue says a proposed matcher change belongs in the bundle repository. Done when the docs explain the current behavior clearly and address the ambiguity raised in the examples.
Written by the indexing model from the issue text.
Description
At first, I thought the regex documentation was wrong, and started to fix it:
| regex | Matches the regex |
- regex: |/image/.*|
- regex: {.jp(e)?g$}i
Although slash is a common character to use to enclose a regular expression, the examples above show using other characters to avoid needing to escape the slashes in the path. So //articles/./ is the same regex as {/articles/.}. See Regular Expressions for more information. Internally, regeg: maps to new RegExp()
But then when I dug into the code, I see that the new RegExp() format doesn't need the regex to be surrounded. I think this needs to be clearer, especially since when I see something like this:
startsWith: /dashboard
regex: /articles/
regex: |/articles/(\d)+| # is this valid?
I assume the regex will match any article (without the slashes, since to PHP programmers it will be natural to assume the slashes are necessary for the regex.
workbox.routing.registerRoute(
new RegExp('{^/products|categories/}')
At the end of my journey down regex lane, here's my trip report:
- the code currently generates new RegExp('$regexString'), which isn't intuitive to PHP programmers and excludes the ability to use flags.
- Instead, I think it should generate the regex string itself, which is javascript, e.g. workbox.routing.registerRoute(/products|categories/, ...
- We could have another matcher, RegExp: that generates what the code currently does, and regex: that generates a javascript regex.
Regardless, the docs should be updated. I'll move my suggestion to an issue in the bundle repo.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 34m
- Merged PRs (30d)
- 40
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Spomky-Labs/docs
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Spomky-Labs/docs#27 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 67/100
Spomky-Labs/docs#26 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
Spomky-Labs/docs#25 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Spomky-Labs/docs#23 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Spomky-Labs/docs#22 ·
Maintainers usually reply within 1 day
All issues in Spomky-Labs/docs
Similar issues
-
backend enhancement priority:P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
geolens-io/geolens#4161 ·
Maintainers usually reply within 1 day
-
pkg:clai2
Difficulty 1/5 Under an hour Newbie friendliness 75/100
pydantic/pydantic-ai#14845 ·
Maintainers usually reply within 1 day
-
Add a languageOpengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
LearningCircuit/local-deep-research#9272 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
patrickballard/wheelgap#783 ·