Home All Groups Group Topic Archive Search About
Author
28 Jun 2006 5:52 PM
Smokey Grindle
I am writing a messaging app (email like) and want to check if a message has
a RE: or FWD: already and if so put a RE[1]: or FWD[1]: type of prefix on it
that increments automatically on each reply to one that has that message
already in it... so the sequence would be like this

Original Message
RE: Original Message
RE[1]: Original Message
RE[2]: Original Message
...... and so on... is there any easy way to do this with a regex or anyone
that has done this before that knows how to? thanks!

Author
28 Jun 2006 6:12 PM
Jared Parsons
Hello Smokey,

> I am writing a messaging app (email like) and want to check if a
> message has a RE: or FWD: already and if so put a RE[1]: or FWD[1]:
> type of prefix on it that increments automatically on each reply to
> one that has that message already in it... so the sequence would be
> like this
>
> Original Message
> RE: Original Message
> RE[1]: Original Message
> RE[2]: Original Message
> ..... and so on... is there any easy way to do this with a regex or
> anyone
> that has done this before that knows how to? thanks!

Try the following regex

  "^RE(\[(?<value>\d+)\])?:.*"

This will match all of the strings you specified.  If the Match object contains
a Group called "value", it will contain the number inside the []'s.  Example

  Dim match As Match = Regex.Match(line, "^RE(\[(?<value>\d+)\])?:.*")
  If match.Success Then
    ' It's a RE: line
    if match.Groups.Contains("value") Then
     ' It has a []
     Dim value As Integer = CInt(match.Groups("value").Value)



--
Jared Parsons [MSFT]
jared***@online.microsoft.com
Author
28 Jun 2006 8:24 PM
Smokey Grindle
Thanks a lot!... I realy need to get regex's memorized so I can actually
understand them better...

Show quoteHide quote
"Jared Parsons" <jared***@online.microsoft.com> wrote in message
news:61f143b1a688c868baea630a33@msnews.microsoft.com...
> Hello Smokey,
>
>> I am writing a messaging app (email like) and want to check if a
>> message has a RE: or FWD: already and if so put a RE[1]: or FWD[1]:
>> type of prefix on it that increments automatically on each reply to
>> one that has that message already in it... so the sequence would be
>> like this
>>
>> Original Message
>> RE: Original Message
>> RE[1]: Original Message
>> RE[2]: Original Message
>> ..... and so on... is there any easy way to do this with a regex or
>> anyone
>> that has done this before that knows how to? thanks!
>
> Try the following regex
>
>  "^RE(\[(?<value>\d+)\])?:.*"
>
> This will match all of the strings you specified.  If the Match object
> contains a Group called "value", it will contain the number inside the
> []'s.  Example
>
>  Dim match As Match = Regex.Match(line, "^RE(\[(?<value>\d+)\])?:.*")
>  If match.Success Then
>    ' It's a RE: line if match.Groups.Contains("value") Then
>     ' It has a [] Dim value As Integer = CInt(match.Groups("value").Value)
>
>
> --
> Jared Parsons [MSFT]
> jared***@online.microsoft.com
>
>
Author
28 Jun 2006 10:14 PM
GhostInAK
Hello Smokey,

Try Expresso from http://www.ultrapico.com/

-Boo

Show quoteHide quote
> Thanks a lot!... I realy need to get regex's memorized so I can
> actually understand them better...
>
> "Jared Parsons" <jared***@online.microsoft.com> wrote in message
> news:61f143b1a688c868baea630a33@msnews.microsoft.com...
>
>> Hello Smokey,
>>
>>> I am writing a messaging app (email like) and want to check if a
>>> message has a RE: or FWD: already and if so put a RE[1]: or FWD[1]:
>>> type of prefix on it that increments automatically on each reply to
>>> one that has that message already in it... so the sequence would be
>>> like this
>>>
>>> Original Message
>>> RE: Original Message
>>> RE[1]: Original Message
>>> RE[2]: Original Message
>>> ..... and so on... is there any easy way to do this with a regex or
>>> anyone
>>> that has done this before that knows how to? thanks!
>> Try the following regex
>>
>> "^RE(\[(?<value>\d+)\])?:.*"
>>
>> This will match all of the strings you specified.  If the Match
>> object contains a Group called "value", it will contain the number
>> inside the []'s.  Example
>>
>> Dim match As Match = Regex.Match(line, "^RE(\[(?<value>\d+)\])?:.*")
>> If match.Success Then
>> ' It's a RE: line if match.Groups.Contains("value") Then
>> ' It has a [] Dim value As Integer =
>> CInt(match.Groups("value").Value)
>> --
>> Jared Parsons [MSFT]
>> jared***@online.microsoft.com
Author
29 Jun 2006 2:48 AM
Smokey Grindle
thanks!

Show quoteHide quote
"GhostInAK" <ghosti***@gmail.com> wrote in message
news:be1391bfc5da8c868d43ed7a4a7@news.microsoft.com...
> Hello Smokey,
>
> Try Expresso from http://www.ultrapico.com/
>
> -Boo
>
>> Thanks a lot!... I realy need to get regex's memorized so I can
>> actually understand them better...
>>
>> "Jared Parsons" <jared***@online.microsoft.com> wrote in message
>> news:61f143b1a688c868baea630a33@msnews.microsoft.com...
>>
>>> Hello Smokey,
>>>
>>>> I am writing a messaging app (email like) and want to check if a
>>>> message has a RE: or FWD: already and if so put a RE[1]: or FWD[1]:
>>>> type of prefix on it that increments automatically on each reply to
>>>> one that has that message already in it... so the sequence would be
>>>> like this
>>>>
>>>> Original Message
>>>> RE: Original Message
>>>> RE[1]: Original Message
>>>> RE[2]: Original Message
>>>> ..... and so on... is there any easy way to do this with a regex or
>>>> anyone
>>>> that has done this before that knows how to? thanks!
>>> Try the following regex
>>>
>>> "^RE(\[(?<value>\d+)\])?:.*"
>>>
>>> This will match all of the strings you specified.  If the Match
>>> object contains a Group called "value", it will contain the number
>>> inside the []'s.  Example
>>>
>>> Dim match As Match = Regex.Match(line, "^RE(\[(?<value>\d+)\])?:.*")
>>> If match.Success Then
>>> ' It's a RE: line if match.Groups.Contains("value") Then
>>> ' It has a [] Dim value As Integer =
>>> CInt(match.Groups("value").Value)
>>> --
>>> Jared Parsons [MSFT]
>>> jared***@online.microsoft.com
>
>