473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Basic Regex Question

How do I ignore something that's part of what I want to find. For
instance..I have this string [33333333]

I have a regex \]\d*\] to find the whole thing. However, I don't want to
have either of the brackets returned..I want my return value to be 33333333
not [33333333].
Our resident regex guru is out on vacation and I'm stumped.

Thanks,

Bill

--
W.G. Ryan
bi**@leavethisout.devbuzz.com
do*********************@comcast.ThisToo.net
Nov 22 '05 #1
9 1411
> I have a regex \]\d*\] to find the whole thing. However, I don't want to
have either of the brackets returned..I want my return value to be 33333333 not [33333333].


Group the area by parentes such as \](\d*)\]
--
Sincerely,
Peter Theill


Nov 22 '05 #2
Peter:

Thanks for the help. I changed it but it's still including the brackets.
I'm obviously messing something up (I'm not very experienced with them yet)

I also tried this (?=[)(\d*)(?=]) and every derivation of the assertions
that I can think of. It stops matching after the first one is found...if I
just do \[(\d*)(?=]) it will return [3333333 b/c I'm not trying to find
anything after that..but if I do it at the beginning, I'm out of gas.

Any Ideas?
Thanks again,

Bill
"Peter Theill" <reply@newsgroups> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
I have a regex \]\d*\] to find the whole thing. However, I don't want to have either of the brackets returned..I want my return value to be

33333333
not [33333333].


Group the area by parentes such as \](\d*)\]
--
Sincerely,
Peter Theill

Nov 22 '05 #3
I have a work around but I know it isn't the right way to do it. If I find
everything with the brackets, and I know that my match there is correct, I
can use that match as my search value and just find successive numbers. But
if I needed something to find ssn's for isntance, 111-11-1111 and didn't
want the hyphens included, this wouldn't work --- I know I'm missing
something b/c these things are too powerful to have to use hacks.

TIA,

Bill
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I ignore something that's part of what I want to find. For
instance..I have this string [33333333]

I have a regex \]\d*\] to find the whole thing. However, I don't want to
have either of the brackets returned..I want my return value to be 33333333 not [33333333].
Our resident regex guru is out on vacation and I'm stumped.

Thanks,

Bill

--
W.G. Ryan
bi**@leavethisout.devbuzz.com
do*********************@comcast.ThisToo.net

Nov 22 '05 #4
> Thanks for the help. I changed it but it's still including the brackets.
I'm obviously messing something up (I'm not very experienced with them

yet)

I haven't worked with RegExp on .NET yet, but normally you're able to pick
out the groups explicitly using syntax like:

RegExp.Parse("[3333333]", "\](\d*)\]").GetGroup(1)

--
Peter Theill
http://theill.com/
Nov 22 '05 #5
I'll give it a try, thanks!
"Peter Theill" <reply@newsgroups> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
Thanks for the help. I changed it but it's still including the brackets. I'm obviously messing something up (I'm not very experienced with them

yet)

I haven't worked with RegExp on .NET yet, but normally you're able to pick
out the groups explicitly using syntax like:

RegExp.Parse("[3333333]", "\](\d*)\]").GetGroup(1)

--
Peter Theill
http://theill.com/

Nov 22 '05 #6
I found the answer... (?<=(|))\d{1,2}[:\.]\d{1,2}(?<=(|)) Thanks Peter
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I ignore something that's part of what I want to find. For
instance..I have this string [33333333]

I have a regex \]\d*\] to find the whole thing. However, I don't want to
have either of the brackets returned..I want my return value to be 33333333 not [33333333].
Our resident regex guru is out on vacation and I'm stumped.

Thanks,

Bill

--
W.G. Ryan
bi**@leavethisout.devbuzz.com
do*********************@comcast.ThisToo.net

Nov 22 '05 #7
Hi William,

As a side not, there is a great free utility for toying with regex stuff:
Expresso
http://www12.brinkster.com/ultrapico...soDownload.htm

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I ignore something that's part of what I want to find. For
instance..I have this string [33333333]

I have a regex \]\d*\] to find the whole thing. However, I don't want to
have either of the brackets returned..I want my return value to be 33333333 not [33333333].
Our resident regex guru is out on vacation and I'm stumped.

Thanks,

Bill

--
W.G. Ryan
bi**@leavethisout.devbuzz.com
do*********************@comcast.ThisToo.net

Nov 22 '05 #8
Thanks Miha!
"Miha Markic" <miha at rthand com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi William,

As a side not, there is a great free utility for toying with regex stuff:
Expresso
http://www12.brinkster.com/ultrapico...soDownload.htm

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I ignore something that's part of what I want to find. For
instance..I have this string [33333333]

I have a regex \]\d*\] to find the whole thing. However, I don't want to have either of the brackets returned..I want my return value to be

33333333
not [33333333].
Our resident regex guru is out on vacation and I'm stumped.

Thanks,

Bill

--
W.G. Ryan
bi**@leavethisout.devbuzz.com
do*********************@comcast.ThisToo.net


Nov 22 '05 #9
I just got it up and running. Very cool indeed, thanks again.
"Miha Markic" <miha at rthand com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi William,

As a side not, there is a great free utility for toying with regex stuff:
Expresso
http://www12.brinkster.com/ultrapico...soDownload.htm

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How do I ignore something that's part of what I want to find. For
instance..I have this string [33333333]

I have a regex \]\d*\] to find the whole thing. However, I don't want to have either of the brackets returned..I want my return value to be

33333333
not [33333333].
Our resident regex guru is out on vacation and I'm stumped.

Thanks,

Bill

--
W.G. Ryan
bi**@leavethisout.devbuzz.com
do*********************@comcast.ThisToo.net


Nov 22 '05 #10

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

Similar topics

1
by: m|sf|t | last post by:
All, If I have this: $xmlstr = str_replace("&", "%amp;%", $xmlstr); How can I use use a regex expression (if it is needed) to do the replace UNLESS the string contains A&E (you know, the TV...
9
by: William Ryan | last post by:
How do I ignore something that's part of what I want to find. For instance..I have this string I have a regex \]\d*\] to find the whole thing. However, I don't want to have either of the...
4
by: engwar1 | last post by:
Not sure where to ask this. Please suggest another newsgroup if this isn't the best place for this question. I'm new to both vb.net and regex. I need a regular expression that will validate what...
4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
6
by: Du Dang | last post by:
Text: ===================== <script1> ***stuff A </script1> ***more stuff <script2> ***stuff B
5
by: Chris | last post by:
How Do I use the following auto-generated code from The Regulator? '------------------------------------------------------------------------------ ' <autogenerated> ' This code was generated...
6
by: Martin Evans | last post by:
Sorry, yet another REGEX question. I've been struggling with trying to get a regular expression to do the following example in Python: Search and replace all instances of "sleeping" with "dead"....
7
by: Extremest | last post by:
I am using this regex. static Regex paranthesis = new Regex("(\\d*/\\d*)", RegexOptions.IgnoreCase); it should find everything between parenthesis that have some numbers onyl then a forward...
5
by: =?Utf-8?B?VG9ueSBXaXNzbGVy?= | last post by:
Hello everyone- I am hoping a couple of you will have some ideas on this one... I have a webform created in visual basic 2005. Basically, the webform gather answers to the questions asked on...
5
by: Jeff | last post by:
....hoping someone can help someone still new to vb.net 2005 with something new to him. ....been successfully using the regular expression validators from the toolbox, but now I have need to do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
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,...

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.