Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Regular Expression Between Exclude Needs Group Name?

Posted on 2009-05-05
5
Medium Priority
?
706 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

721 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