473,387 Members | 1,540 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,387 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 2025
^([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
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.