Solved

Regular Expression Between Exclude Needs Group Name?

Posted on 2009-05-05
5
677 Views
Last Modified: 2012-05-06
I thought I used this expression (below) with success, but Expresso Regex Builder keeps returning this error:

Error: Invalid Group Name. Group names must begin with a word character

I'm trying to extract everything between ^ and ^ but exclude both ^

(?<\^).*(?=\^)
0
Comment
Question by:pointeman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24308916
Try

\^(.*?)\^
0
 
LVL 6

Expert Comment

by:obrienslalom
ID: 24308921
The syntax (?<groupname>pattern) can be used to name a capture group.  The assertions are probably overkill for something like this anyway.  You can get your data by utilizing your capture groups.  Note: the ^ character is an anchor, so they are escaped in the expression.

\^(.*?)\^

Open in new window

0
 
LVL 6

Expert Comment

by:obrienslalom
ID: 24308936
Sorry kaufmed...ignore my post
0
 

Author Comment

by:pointeman
ID: 24309203
This: \^(.*?)\^
Returns this: ^12345678^
I also need to exclude both ^ from the result...
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 250 total points
ID: 24309301
Check the second group:
Match match = Regex.Match("^12345^", "\^(.*?)\^");
 
string result = match.Groups[1].Value;

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question