escaping the | symbol

 
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting
View previous topic :: View next topic  
Author Message
thinkr
-


Joined: 24 Oct 2013
Posts: 15
Location: California

PostPosted: Fri Nov 28, 2014 3:14 am    Post subject: escaping the | symbol Reply with quote

Hello, I tried using URL Redirect to redirect a bogus URL that contained a | symbol. I tried escaping the character with a backslash: \. However, the resulting \| still treats the | like an OR, not a character. How do I succeed in escaping the pipe symbol? Or is this a problem with my very old version of abyss x2 v2.8?
_________________
If you don't question it then you don't know it.
Back to top View user's profile Send private message
pkSML
-


Joined: 29 May 2006
Posts: 941
Location: Michigan, USA

PostPosted: Sun Nov 30, 2014 10:13 pm    Post subject: Reply with quote

This isn't too hard to achieve. I'm using X2 v2.8 as well.
Here's the code I used.

Virtual path regex:
Code:
^/[^\|]*\|[^\|]*$


It catches any URL with the pipe in it (including JUST the pipe).


_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
Horizon
-


Joined: 18 Feb 2022
Posts: 21

PostPosted: Sun Apr 24, 2022 10:30 pm    Post subject: Reply with quote

If anyone is still looking for how to do this, you can read this:
Quote:
\0dd character with octal code 0dd
\ddd character with octal code ddd, or back reference
\o{ddd..} character with octal code ddd..
\xhh character with hex code hh
\x{hhh..} character with hex code hhh.. (non-JavaScript mode)
\uhhhh character with hex code hhhh (JavaScript mode only)

Quote:
(4) \u matches a lower case "u" character unless it is followed by four
hexadecimal digits, in which case the hexadecimal number defines the
code point to match. By default, \u causes a compile time error (Perl
uses it to upper case the following character).

That means you can do this to escape the | character:
Quote:
\x{7C}
or
Quote:
\u007C

0x7C is the hex byte that represents the | character.
0x5C is the one for \ (if you need it).

You can use any hex editor to find the hex value for a character.

More details:
Quote:
Constraints on character values

Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-
called "surrogate" codepoints), and 0xffef.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group