Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

RegEx for \x###

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arthur Dent - 16 Oct 2007 17:02 GMT
Hello all, i am trying to write a regex to find escaped characters in a
string of the form "\x009" ...
to parse strings that look something like this... "My dog jumps\x013\x010"

I had that working fine, with the regex "\\[x]\d{3}"

Now i wanted to extend it so that it would NOT count them when the leading
slash is itself, preceeded by a slash (escaped).
so this sentence would NOT match... "My dog jumps\\x013\\x010"

This is where i ran into problems.
I tried doing this... [^\\]?\\[x]\d{3}  but the problem is then that it
includes the preceeding, non-slash character in any matches, which i dont
want.So in this, "My dog jumps\x013\x010" the matches returned would be
"s\x013" and "\x010". I do not want that "s" on the front, but i need to
make sure the slash isnt doubled (escaped).

Any help with my regex? Thanks in advance,
- Arthur.
rowe_newsgroups - 16 Oct 2007 17:17 GMT
On Oct 16, 12:02 pm, "Arthur Dent" <hitchhikersguideto-n...@yahoo.com>
wrote:
> Hello all, i am trying to write a regex to find escaped characters in a
> string of the form "\x009" ...
[quoted text clipped - 15 lines]
> Any help with my regex? Thanks in advance,
> - Arthur.

The (?<= ) group will match a prefix, but it won't include it in the
results. With that said I believe your Regex should become:

(?<=[^\\])?\\[x]\d{3}

By the way, I tested this with Expresso, which is a great tool for
Regex.

Thanks,

Seth Rowe
Arthur Dent - 16 Oct 2007 17:43 GMT
Thanks for the great tip - that Expresso tool IS way cool!

Your regex worked fine, too. Though, thanks to Expresso,  ;)  ...
i was able to pare it down even a little further...

from         (?<=[^\\])?\\[x]\d{3}
to             (?<![\\])\\[x]\d{3}

Thanks for the great info.... CheerZ!

> On Oct 16, 12:02 pm, "Arthur Dent" <hitchhikersguideto-n...@yahoo.com>
> wrote:
[quoted text clipped - 31 lines]
>
> Seth Rowe

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.