Solved

Regular Expression Between Exclude Needs Group Name?

Posted on 2009-05-05
5
693 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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