473,385 Members | 1,317 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,385 software developers and data experts.

regular expression syntax

Hi,

Can you tell me the regular expression syntax needed to validate an Excel
Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim

Nov 22 '05 #1
16 2024
^([a-zA-Z]+)(\d+)$

Note: this will not accept R1C1-references!

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel
Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim

Nov 22 '05 #2
^([a-zA-Z]+)(\d+)$

Note: this will not accept R1C1-references!

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel
Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim

Nov 22 '05 #3
Thanks for the reply,
This expression also acepts invalid entries e.g. QQ1, F99999 etc.
I only want to accept A1 throught to IV65535, valid cell referneces.
I am a complete expression novice, so don't understand why.

Thanks
Tim

"Niki Estner" <ni*********@cube.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
^([a-zA-Z]+)(\d+)$

Note: this will not accept R1C1-references!

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim


Nov 22 '05 #4
Thanks for the reply,
This expression also acepts invalid entries e.g. QQ1, F99999 etc.
I only want to accept A1 throught to IV65535, valid cell referneces.
I am a complete expression novice, so don't understand why.

Thanks
Tim

"Niki Estner" <ni*********@cube.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
^([a-zA-Z]+)(\d+)$

Note: this will not accept R1C1-references!

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim


Nov 22 '05 #5

I believe this expression will do it, but I haven't thoroughly tested it:

^([A-Z]|[A-I][A-V])(?>0*)(6553[0-6]|655[0-2]\d{1}|65[0-4]\d{2}|6[0-4]\d{3}|[
1-5]\d{4}|\d{2,4}|[1-9])$

You can use the Ignore Case option if you want to match capital or lower
case letters.
This should match A1 - IV65536.

Brian Davis
http://www.knowdotnet.com

"Tim Marsden" <TM@UK.COM> wrote in message
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel
Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim

Nov 22 '05 #6

I believe this expression will do it, but I haven't thoroughly tested it:

^([A-Z]|[A-I][A-V])(?>0*)(6553[0-6]|655[0-2]\d{1}|65[0-4]\d{2}|6[0-4]\d{3}|[
1-5]\d{4}|\d{2,4}|[1-9])$

You can use the Ignore Case option if you want to match capital or lower
case letters.
This should match A1 - IV65536.

Brian Davis
http://www.knowdotnet.com

"Tim Marsden" <TM@UK.COM> wrote in message
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel
Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim

Nov 22 '05 #7
This is possible, look for IP-address-validation examples on the net to get
the idea.
However, these range-check-regexes tend to get unreadable: if you will
convert the reference to row/column indices afterwards anyway, I'd suggest
doing the range check on these integers instead of inside the regex - this
will be more readable in most cases and more efficient in all cases. Integer
comparison operators are damn efficient and quite readable.

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:eZ**************@tk2msftngp13.phx.gbl...
Thanks for the reply,
This expression also acepts invalid entries e.g. QQ1, F99999 etc.
I only want to accept A1 throught to IV65535, valid cell referneces.
I am a complete expression novice, so don't understand why.

Thanks
Tim

"Niki Estner" <ni*********@cube.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
^([a-zA-Z]+)(\d+)$

Note: this will not accept R1C1-references!

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim



Nov 22 '05 #8
This is possible, look for IP-address-validation examples on the net to get
the idea.
However, these range-check-regexes tend to get unreadable: if you will
convert the reference to row/column indices afterwards anyway, I'd suggest
doing the range check on these integers instead of inside the regex - this
will be more readable in most cases and more efficient in all cases. Integer
comparison operators are damn efficient and quite readable.

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:eZ**************@tk2msftngp13.phx.gbl...
Thanks for the reply,
This expression also acepts invalid entries e.g. QQ1, F99999 etc.
I only want to accept A1 throught to IV65535, valid cell referneces.
I am a complete expression novice, so don't understand why.

Thanks
Tim

"Niki Estner" <ni*********@cube.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
^([a-zA-Z]+)(\d+)$

Note: this will not accept R1C1-references!

Niki

"Tim Marsden" <TM@UK.COM> wrote in
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim



Nov 22 '05 #9
Hi Tim,

Thanks for your post. In addition to the replied from other community
members, I also recommend you the following web site:
http://regexlib.com/Default.aspx

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 22 '05 #10
Hi Tim,

Thanks for your post. In addition to the replied from other community
members, I also recommend you the following web site:
http://regexlib.com/Default.aspx

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 22 '05 #11
Many Thanks for all suggests, will test and post results

"Brian Davis" <br***@knowdotnet.nospam.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...

I believe this expression will do it, but I haven't thoroughly tested it:

^([A-Z]|[A-I][A-V])(?>0*)(6553[0-6]|655[0-2]\d{1}|65[0-4]\d{2}|6[0-4]\d{3}|[ 1-5]\d{4}|\d{2,4}|[1-9])$

You can use the Ignore Case option if you want to match capital or lower
case letters.
This should match A1 - IV65536.

Brian Davis
http://www.knowdotnet.com

"Tim Marsden" <TM@UK.COM> wrote in message
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim


Nov 22 '05 #12
Many Thanks for all suggests, will test and post results

"Brian Davis" <br***@knowdotnet.nospam.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...

I believe this expression will do it, but I haven't thoroughly tested it:

^([A-Z]|[A-I][A-V])(?>0*)(6553[0-6]|655[0-2]\d{1}|65[0-4]\d{2}|6[0-4]\d{3}|[ 1-5]\d{4}|\d{2,4}|[1-9])$

You can use the Ignore Case option if you want to match capital or lower
case letters.
This should match A1 - IV65536.

Brian Davis
http://www.knowdotnet.com

"Tim Marsden" <TM@UK.COM> wrote in message
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim


Nov 22 '05 #13
Hi Tim,

Do you have any update that you'd like to share with us?

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 22 '05 #14
Thanks,

The suggested expression works as expected.
"Brian Davis" <br***@knowdotnet.nospam.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...

I believe this expression will do it, but I haven't thoroughly tested it:

^([A-Z]|[A-I][A-V])(?>0*)(6553[0-6]|655[0-2]\d{1}|65[0-4]\d{2}|6[0-4]\d{3}|[ 1-5]\d{4}|\d{2,4}|[1-9])$

You can use the Ignore Case option if you want to match capital or lower
case letters.
This should match A1 - IV65536.

Brian Davis
http://www.knowdotnet.com

"Tim Marsden" <TM@UK.COM> wrote in message
news:Of*************@TK2MSFTNGP10.phx.gbl...
Hi,

Can you tell me the regular expression syntax needed to validate an Excel Cell Reference.
e.g. A1, B1200, IV54000 etc

Thank
Tim


Nov 22 '05 #15
Are you sure? Just from looking at it.. doesn't that say the letter
part has to either be a single letter A-Z or A-I followed by A-V? So
doesn't that mean AX or AY would not match? It seems like you'd
need... A-Z or A-H+A-Z or I+A-V..

What about the possible $'s? Like $AY$345?

thanks,
Backslider

"Tim Marsden" <TM@UK.COM> wrote in message news:<#Z**************@TK2MSFTNGP11.phx.gbl>...
Thanks,

The suggested expression works as expected.
"Brian Davis" <br***@knowdotnet.nospam.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...

I believe this expression will do it, but I haven't thoroughly tested it:

^([A-Z]|[A-I][A-V])(?>0*)(6553[0-6]|655[0-2]\d{1}|65[0-4]\d{2}|6[0-4]\d{3}|[
1-5]\d{4}|\d{2,4}|[1-9])$

You can use the Ignore Case option if you want to match capital or lower
case letters.
This should match A1 - IV65536.

Nov 22 '05 #16
Thanks

I think you are right. Can you suggest the correct expression?

Tim

"Backslider" <ba********@mail.com> wrote in message
news:c3**************************@posting.google.c om...
Are you sure? Just from looking at it.. doesn't that say the letter
part has to either be a single letter A-Z or A-I followed by A-V? So
doesn't that mean AX or AY would not match? It seems like you'd
need... A-Z or A-H+A-Z or I+A-V..

What about the possible $'s? Like $AY$345?

thanks,
Backslider

"Tim Marsden" <TM@UK.COM> wrote in message

news:<#Z**************@TK2MSFTNGP11.phx.gbl>...
Thanks,

The suggested expression works as expected.
"Brian Davis" <br***@knowdotnet.nospam.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...

I believe this expression will do it, but I haven't thoroughly tested it:

^([A-Z]|[A-I][A-V])(?>0*)(6553[0-6]|655[0-2]\d{1}|65[0-4]\d{2}|6[0-4]\d{3}|[
1-5]\d{4}|\d{2,4}|[1-9])$

You can use the Ignore Case option if you want to match capital or lower case letters.
This should match A1 - IV65536.

Nov 22 '05 #17

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

Similar topics

1
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...
4
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...
5
by: Ryan | last post by:
HELLO I am using the following MICROSOFT SUGGESTED (somewhere on msdn) regular expression to validate email addresses however I understand that the RFP allows for "+" symbols in the email address...
6
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...
3
by: LordHog | last post by:
Hello all, I am attempting to create a small scripting application to be used during testing. I extract the commands from the script file I was going to tokenize the each line as one of the...
0
isladogs
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.