473,511 Members | 15,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular Expression Syntax

I found this on the Internet and tried a few of them and they worked in
VS2008.
Actually it was in a different form but I converted to make a smaller file.
The data is the same as the original.

I'm confused about how regular expressions work in different systems.
I suspect that each system may have some things that do not work in other
systems.
So my question is: Do the things in the table below work on VS2008?
And what is Posix and machine mode?

Thanks in advance for any help.
BASIC METACHARACTERS
.. Match any single character
| Or
[] Match one of a set of characters
[^] Negate a set of characters
- Define a range of characters eg. [0-9]
\ Escape the next character
QUANTIFIERS
* Match zero or more of the previous character
*? Lazy version of *
+ Match one or more of the previous character
+? Lazy version of +
? Match zero or one of the previous character
{n} Match exact number of instances
{m,n} Match a range of instances
{n,} Match n or more instances
{n,}? Lazy version on {n,}
ANCHORS
^ Match start of string
\A Match start of string
$ Match end of string
\Z Match end of string
\< Match start of word
\Match end of word
\b Match a word boundary
\B Opposite of \b
SPECIFIC CHARACTERS
[\b] Backspace
\c Match a control character
\d Match any digit
\D Opposite of \d
\f Form feed
\n Line feed
\r Carriage return
\s Match any white space character
SPECIFIC CHARACTERS (con't)
\S Match anything but white space character
\t Tab
\v Vertical tab
\w Match any alphanumeric character, digit or underscore
\W Opposite of \w
\x Match a hexadecimal number
\0 Match octal number
BACKREFERENCES & LOOKAROUND
() Define subexpression
\n Match nth subexpression
?= Lookahead
?! Negative lookahead
CASE CONVERSION
\E Terminate \L or \U
\l Convert next character to lowercase
\L Convert all characters up to \E to lowercase
\u Convert next character to uppercase
\U Convert all characters up to \E to uppercase
MODIFIERS
(?m) Multiline mode
POSIX
[:alnum:] Any letter or digit
[:alpha:] Any letter
[:blank:] Space or tab
[:cntrl:] ASCII control
[:digit:] Any digit
[:print:] Any printable character
[:graph:] Same as [:print:] but excludes space
[:lower:] Any lower case character
[:punct:] Any character that is in not [:alnum:] or [:cntrl:]
[:space:] Any whitespace character including space
[:upper:] Any uppercase character
[:xdigit:] Any hexadecimal digit
Jun 27 '08 #1
1 1572
On 2008-04-21, AAaron123 <aa*******@roadrunner.comwrote:
I found this on the Internet and tried a few of them and they worked in
VS2008.
Actually it was in a different form but I converted to make a smaller file.
The data is the same as the original.

I'm confused about how regular expressions work in different systems.
I suspect that each system may have some things that do not work in other
systems.
So my question is: Do the things in the table below work on VS2008?
And what is Posix and machine mode?

Thanks in advance for any help.
BASIC METACHARACTERS
. Match any single character
| Or
[] Match one of a set of characters
[^] Negate a set of characters
- Define a range of characters eg. [0-9]
\ Escape the next character
QUANTIFIERS
* Match zero or more of the previous character
*? Lazy version of *
+ Match one or more of the previous character
+? Lazy version of +
? Match zero or one of the previous character
{n} Match exact number of instances
{m,n} Match a range of instances
{n,} Match n or more instances
{n,}? Lazy version on {n,}
ANCHORS
^ Match start of string
\A Match start of string
$ Match end of string
\Z Match end of string
\< Match start of word
\Match end of word
\b Match a word boundary
\B Opposite of \b
SPECIFIC CHARACTERS
[\b] Backspace
\c Match a control character
\d Match any digit
\D Opposite of \d
\f Form feed
\n Line feed
\r Carriage return
\s Match any white space character
SPECIFIC CHARACTERS (con't)
\S Match anything but white space character
\t Tab
\v Vertical tab
\w Match any alphanumeric character, digit or underscore
\W Opposite of \w
\x Match a hexadecimal number
\0 Match octal number
BACKREFERENCES & LOOKAROUND
() Define subexpression
\n Match nth subexpression
?= Lookahead
?! Negative lookahead
CASE CONVERSION
\E Terminate \L or \U
\l Convert next character to lowercase
\L Convert all characters up to \E to lowercase
\u Convert next character to uppercase
\U Convert all characters up to \E to uppercase
MODIFIERS
(?m) Multiline mode
POSIX
[:alnum:] Any letter or digit
[:alpha:] Any letter
[:blank:] Space or tab
[:cntrl:] ASCII control
[:digit:] Any digit
[:print:] Any printable character
[:graph:] Same as [:print:] but excludes space
[:lower:] Any lower case character
[:punct:] Any character that is in not [:alnum:] or [:cntrl:]
[:space:] Any whitespace character including space
[:upper:] Any uppercase character
[:xdigit:] Any hexadecimal digit

Regular Expression syntax various from implementation to implementation.
So you would probably be better off just starting here:

http://msdn2.microsoft.com/en-us/library/hs600312.aspx

Along with that, you might want to download Expresso:

http://www.ultrapico.com/Expresso.htm

Which is .NET based Regex development tool.

--
Tom Shelton
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8280
by: Chris Lasher | last post by:
Hello, I would like to create a set of very similar regular expression. In my initial thought, I'd hoped to create a regular expression with a variable inside of it that I could simply pass a...
1
4155
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
4
5104
by: Buddy | last post by:
Can someone please show me how to create a regular expression to do the following My text is set to MyColumn{1, 100} Test I want a regular expression that sets the text to the following...
8
7308
by: Rajeev Soni | last post by:
Hi I am looking for the regular expression for validating the allowed file types to upload like files like "zip,pdf,doc,rtf,gif,jpg,png,txt"; and the expression should not be case sensitive like...
5
3089
by: Ryan | last post by:
HELLO I am using the following MICROSOFT SUGGESTED (somewhere on msdn) regular expression to validate email addresses however I understand that the RFP allows for "+" symbols in the email address...
6
2275
by: Ludwig | last post by:
Hi, i'm using the regular expression \b\w to find the beginning of a word, in my C# application. If the word is 'public', for example, it works. However, if the word is '<public', it does not...
3
3316
by: LordHog | last post by:
Hello all, I am attempting to create a small scripting application to be used during testing. I extract the commands from the script file I was going to tokenize the each line as one of the...
3
2552
by: Zach | last post by:
Hello, Please forgive if this is not the most appropriate newsgroup for this question. Unfortunately I didn't find a newsgroup specific to regular expressions. I have the following regular...
5
8251
by: Noah Hoffman | last post by:
I have been trying to write a regular expression that identifies a block of text enclosed by (potentially nested) parentheses. I've found solutions using other regular expression engines (for...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.