Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Regular expressions

Reply
Thread Tools

Regular expressions

 
 
Rok Jaklic
Guest
Posts: n/a
 
      10-04-2005
Hello.

Is it possible to match with regular expressions something like this:

XXXX
0XXX
XXX0

where X is the same number for example: 1111,2222, 0111, 1110 ...

or ABCD: for example 1234, ... 5678, 6789 ...

And if, would "you" give me a hint or something, because I have one
terrible solution, where I would check for every possible number
without regular expressions...

Thank you,

Regards,

Rok

 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      10-04-2005
Rok Jaklic <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Hello.
>
> Is it possible to match with regular expressions something like this:
>
> XXXX
> 0XXX
> XXX0
>
> where X is the same number for example: 1111,2222, 0111, 1110 ...


/(\d)\1{3}\n0\1{3}\n\1{3}0/

(Look up "backreference" in perlre.)

> or ABCD: for example 1234, ... 5678, 6789 ...


I don't understand what you are saying here.

Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
 
Reply With Quote
 
 
 
 
Rok Jaklic
Guest
Posts: n/a
 
      10-04-2005
Hi.

Thank you for a quick response.

ABCD (4 numbers, where if A is for example 1, then B is A+1, C is A+2
(or B+1) and D is A+3 (or C+1).

Regards,

Rok

 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      10-04-2005
Rok Jaklic <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Hi.
>
> Thank you for a quick response.


Whom are you thanking for what response? Please provide attributions
and some context with your reply.

> ABCD (4 numbers, where if A is for example 1, then B is A+1, C is A+2
> (or B+1) and D is A+3 (or C+1).


Without context, this is just as incomprehensible as your first
attempt.

What is B when A is 9? A two-digit number?

A regex isn't a good tool to recognize consecutive numbers. You should
probably split the string into digits and use some other means.

Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
 
Reply With Quote
 
Rok Jaklic
Guest
Posts: n/a
 
      10-04-2005

Anno Siegel wrote:
> Whom are you thanking for what response? Please provide attributions
> and some context with your reply.

To you, since you are the only one who did replay ... ?!?!?!?

> What is B when A is 9? A two-digit number?

Ohh. I am sorry. I did not see this "problem". Just forget it.

> A regex isn't a good tool to recognize consecutive numbers. You should
> probably split the string into digits and use some other means.

OK.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Regular Expressions in ASP.net Jay Douglas ASP .Net 3 11-03-2003 08:09 PM
Regular expressions mark Perl 4 10-28-2003 12:37 PM
perl regular expressions return last matched occurence? Dustin D. Perl 1 08-28-2003 01:51 AM
matching curly braces and regular expressions Dustin D. Perl 0 08-26-2003 11:18 PM
Add custom regular expressions to the validation list of available expressions Jay Douglas ASP .Net 0 08-15-2003 10:19 PM



Advertisments