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

regex is greedy #5

Closed
andywebber opened this issue Feb 28, 2013 · 1 comment
Closed

regex is greedy #5

andywebber opened this issue Feb 28, 2013 · 1 comment
Labels

Comments

@andywebber
Copy link

It is sometimes useful to leave the old content in a page that is redirected (for posterity, for inclusion in search results, etc).

However, if the page includes any other markup which uses "~~" notation, the pageredirect plugin fails badly (generates a blank page). The reason is that the regex used to match "REDIRECT>page" is greedy; it should be lazy

Test case: page with:

  ~~REDIRECT>anotherpage~~
  ~~CLEARFLOAT~~
  ~~DISCUSSION~~

See "Tips" under https://www.dokuwiki.org/devel:syntax_plugins#patterns

Pattern should perhaps be something like (?:REDIRECT>.+?|^#(?i:redirect) [^\r\n]+), but I haven't tested this.

@ssahara
Copy link

ssahara commented May 25, 2013

Is this issue topic still open? I also suffering from mismatch of "REDIRECT>.+?", which matches other markup that uses "~~". Attempt to match pageid fails due to the greediness of pattern ".+?".

I would like to propose "(REDIRECT>.*?|^#(?i:redirect) [^\n]+)".

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

No branches or pull requests

2 participants