I have the following words, and I want to extract the first part and the
trailing numbers.
OP001 =ABC, 001
ST02 =CD, 02
00A =00A, null
I have the following regular express:
(?<first>.*?)(?<second>\d+)
This one works well for the given first two examples but not the third one.
And (?<first>.*?)(?<second>\d+)$ returns strange result. 5 1998
I'm unfamiliar with the <first<secondsyntax you're using, but the
following regular expression works for the three samples given:
Regex.Replace("OP001", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "OP, 001"
Regex.Replace("ST02", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "CD, 02"
Regex.Replace("00A", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "00A, "
"Matt" <Ma**@discussions.microsoft.comwrote in message
news:FC**********************************@microsof t.com...
>I have the following words, and I want to extract the first part and the
trailing numbers.
OP001 =ABC, 001
ST02 =CD, 02
00A =00A, null
I have the following regular express:
(?<first>.*?)(?<second>\d+)
This one works well for the given first two examples but not the third
one.
And (?<first>.*?)(?<second>\d+)$ returns strange result.
I am using match.Groups.
"Brandon Gano" wrote:
I'm unfamiliar with the <first<secondsyntax you're using, but the
following regular expression works for the three samples given:
Regex.Replace("OP001", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "OP, 001"
Regex.Replace("ST02", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "CD, 02"
Regex.Replace("00A", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "00A, "
"Matt" <Ma**@discussions.microsoft.comwrote in message
news:FC**********************************@microsof t.com...
I have the following words, and I want to extract the first part and the
trailing numbers.
OP001 =ABC, 001
ST02 =CD, 02
00A =00A, null
I have the following regular express:
(?<first>.*?)(?<second>\d+)
This one works well for the given first two examples but not the third
one.
And (?<first>.*?)(?<second>\d+)$ returns strange result.
Yes, it works. Thanks.
However, there is another match, for a number
123 =123, null
how to add this one to the regular express?
"Brandon Gano" wrote:
I'm unfamiliar with the <first<secondsyntax you're using, but the
following regular expression works for the three samples given:
Regex.Replace("OP001", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "OP, 001"
Regex.Replace("ST02", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "CD, 02"
Regex.Replace("00A", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "00A, "
"Matt" <Ma**@discussions.microsoft.comwrote in message
news:FC**********************************@microsof t.com...
I have the following words, and I want to extract the first part and the
trailing numbers.
OP001 =ABC, 001
ST02 =CD, 02
00A =00A, null
I have the following regular express:
(?<first>.*?)(?<second>\d+)
This one works well for the given first two examples but not the third
one.
And (?<first>.*?)(?<second>\d+)$ returns strange result.
Sorry, should be
123 =null, 123
"Matt" wrote:
Yes, it works. Thanks.
However, there is another match, for a number
123 =123, null
how to add this one to the regular express?
"Brandon Gano" wrote:
I'm unfamiliar with the <first<secondsyntax you're using, but the
following regular expression works for the three samples given:
Regex.Replace("OP001", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "OP, 001"
Regex.Replace("ST02", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "CD, 02"
Regex.Replace("00A", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "00A, "
"Matt" <Ma**@discussions.microsoft.comwrote in message
news:FC**********************************@microsof t.com...
>I have the following words, and I want to extract the first part and the
trailing numbers.
>
OP001 =ABC, 001
ST02 =CD, 02
00A =00A, null
>
I have the following regular express:
(?<first>.*?)(?<second>\d+)
This one works well for the given first two examples but not the third
one.
>
And (?<first>.*?)(?<second>\d+)$ returns strange result.
>
Try something like this (not tested):
(.*\D+)?(\d*)
"Matt" <Ma**@discussions.microsoft.comwrote in message
news:AB**********************************@microsof t.com...
Sorry, should be
123 =null, 123
"Matt" wrote:
>Yes, it works. Thanks.
However, there is another match, for a number
123 =123, null
how to add this one to the regular express?
"Brandon Gano" wrote:
I'm unfamiliar with the <first<secondsyntax you're using, but the
following regular expression works for the three samples given:
Regex.Replace("OP001", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "OP,
001"
Regex.Replace("ST02", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "CD, 02"
Regex.Replace("00A", @"(.*\D+)(\d*)", @"$1, $2"); // Returns: "00A, "
"Matt" <Ma**@discussions.microsoft.comwrote in message
news:FC**********************************@microsof t.com... I have the following words, and I want to extract the first part and the
trailing numbers.
OP001 =ABC, 001
ST02 =CD, 02
00A =00A, null
I have the following regular express:
(?<first>.*?)(?<second>\d+)
This one works well for the given first two examples but not the
third
one.
And (?<first>.*?)(?<second>\d+)$ returns strange result. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jack Smith |
last post by:
I posted this question earlier, but I got no responses. Can anyone
help me out here...any hints or even how to start? Thanks in advance.
Let doubleswap(x) be the string formed by replacing each...
|
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...
|
by: Glenn Kidd |
last post by:
I am trying express a regular expresion used for substitution that is
causing me problems and I was hoping that someone might be able to
help me. The first part of the regular expression is easy,...
|
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...
|
by: Neri |
last post by:
Some document processing program I write has to deal with documents
that have headers and footers that are unnecessary for the main
processing part. Therefore, I'm using a regular expression to go...
|
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...
|
by: Chris |
last post by:
Hi everyone,
I'm trying to parse through the contents of some text files with regular
expressions, but am new to regular expressions and how to use them in
VB.net.
I'm pretty sure that the...
|
by: Peter |
last post by:
Hello,
I can't find a real concrete answer to the question, "What is the different
between Visual Basic 2005 and Visual Basic 2005 Express?". In other words,
what has been removed from VB to...
|
by: shaoen01 |
last post by:
Hi,
I am new to Perl and stumbled onto some regular expressions and not sure if i am right in interpreting it.
If my text is "My organization is great!"
Regular express used: s/z*/s/
...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |