How can I find number sequences?

# Thread: How can I find number sequences?

1. Junior Member
Join Date
Dec 1969
Posts
4

## How can I find number sequences?

I&#039;m new on this regular expressions stuff and I hope someone can help me.<BR><BR>I need to capture and process number&#039;s sequences from a Textarea and find out the quantities on each sequence, line by line. <BR>For example: The user can enter numbers like these in the textarea control:<BR><BR>2001-2005<BR>555555<BR>6667 6668<BR>2556 to 2559<BR>301, 305<BR><BR>From that, I need to know the units on each sequence, where it begins and where it ends.<BR><BR>From the example:<BR><BR>Line 1: 5 units in sequence, begins in 2001 and ends in 2005<BR>Line 2: 1 units in sequence, begins in 555555 and ends in 555555<BR>Line 3: 2 units in sequence, begins in 6667 and ends in 6668<BR>Line 4: 4 units in sequence, begins in 2556 and ends in 2559<BR>Line 5: 5 units in sequence, begins in 301 and ends in 305<BR><BR>As you see, users could use any character for separating each sequence&#039;s bounds and they would press enter key (CrLf) for each line. I don&#039;t need the lines ordered, just the bounds and the quantities.<BR><BR>Doesn&#039;t matter if this validation is done either Client-Sided (javascript) or Server-Sided (ASP/VBscript), you decide.<BR><BR>Thanks in advance.<BR><BR>

2. Junior Member
Join Date
Dec 1969
Posts
5

## RE: How can I find number sequences?

you could perhaps use the pattern<BR><BR>([d]+)([^d]+)([d]+)<BR><BR>which looks for (numbers)(non numbers)(numbers)<BR><BR>then you can take the submatch 0 and 2, these will be your numbers.<BR><BR>Convert them to Integers and you range is from the smaller to the larger.<BR><BR>Mat

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•