Reputation: 482
I would place the following regexp: ^(?!\s)[^0-9!#|$^`\\~_%&\"'(){}*+,./:;<=>?@\]\[]*(?<!\s)$
in the ASCII doc table.
Example Ascii doc:
[%autowidth]
|===
|Path|Type|Validation|Rule|Description
| type
| String
| Required
| <here I would like to place it>
|Placeholder
|===
I tried many ways to handle that but with no results. I used for e.g."
But all of this methods use special characters that are also in my regex. Do you have an idea how can I display any string using Ascii doc functionalities?
Upvotes: 0
Views: 67
Reputation: 4521
Do you want the regex to look like regular prose? If so, place it directly in the table markup and escape select markup characters with a backslash:
| \^(?!\s)[^0-9!#\|$^`\\~_%&\"'(){}*+,./:;<=>?@\]\[]*(?<!\s)$
Here, the initial caret is escaped to prevent superscript, and the pipe is escaped to prevent introducing a new table cell.
If you want the regex to show as inline monospace, do the same thing but surround the regex with unconstrained inline monospace markup "``":
| ``\^(?!\s)[^0-9!#\|$^`\\~_%&\"'(){}*+,./:;<=>?@\]\[]*(?<!\s)$``
Using HTML entities is another choice that can work, but makes the content harder to maintain.
AsciiDoc has a feature called Literal Monospace that would be the correct solution if your regex does not contain a plus symbol. Since there is a plus, it doesn't work like you expect.
The pass::[]
macro could be used, but escaping the regex is harder.
Upvotes: 1
Reputation: 582
Just convert your line to the HTML codes:
^(?!\s)[^0-9!#|$^`\\~_%&\"'(){}*+,./:;<=>?@\]\[]*(?<!\s)$
It works with Ascii doc version 2.0.10
Upvotes: 2