SID-02522: Regex search: lookaheads
| Status: |
Asked |
TWiki version: |
6.1.0 |
Perl version: |
5.038002 (linux) |
| Category: |
CategoryApplications |
Server OS: |
Linux 6.1.0 |
Last update: |
2 months ago |
I am trying to read the content of a single-column table with regex search (
type="regex" multiple="on" ).
The column looks like this:
|*Name*|
|Work|
|Private|
|Organisation|
|Partner|
|Other|
Search pattern
.*\|.*?\|.* works fine, as does
\|.*?\|, but the results include the "|" starting and ending the table column. Therefore I tried to use regex lookups, but I can't get it working.
I tried:
.*?(?<=\|).*?(?=\|).*
.*?(?<=(\|)).*?(?=(\|)).*
(?<=(\|)).*?(?=(\|))
and many others, but all without any result. Can someone explain how to use lookups in regex SEARCH?
Additionally, I want to exclude the column header with the
*Name*.
Search pattern
(?<=^\|)[^\*].*?(?=\|) works fine in regex101.com, but not in TWiki, nor does pattern
(?<=^\|)[!\*].*?(?=\|) (with an exclamation mark for the negotiation).
What am I doing wrong?
--
Emiel Van Riel - 2025-10-27
Discussion and Answer
I am not clear on what you want to achieve. Could you provide an example of input, and expected search output?
--
Peter Thoeny - 2025-11-24
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.