473,788 Members | 2,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regular expresdions help required

jnc
I was wondering whether anyone could help me out splitting out the following
string (an excel formula) using a regular expression. What I would like to
be able to do is get the dependency paths, the sheets names and the rows and
columns split into seperate variables.

"=[dependencytwo.x ml]Sheet1!R1C1+[dependencytwo.x ml]Sheet1!R1C2"


Jul 21 '05 #1
1 1521
> I was wondering whether anyone could help me out splitting out the
following
string (an excel formula) using a regular expression. What I would like to be able to do is get the dependency paths, the sheets names and the rows and columns split into seperate variables.

"=[dependencytwo.x ml]Sheet1!R1C1+[dependencytwo.x ml]Sheet1!R1C2"


I suggest to use a regular expression to match each cell and retrieving
information about each match with backreferences.
VB code follows.

Imports System.Text.Reg ularExpressions

....

Dim Rx As RegEx = New
RegEx("(\[)?<DEP>[^])]+?\]){0,1}((?<SHEET >[A-z,0-9]+?)\!){0,1}R(?< ROW>[0-9]+
?)C(?<COL>[0-9]+?)")
Dim Cells As MatchCollection = RegEx.Matches(" string to be parsed")
Dim Cell As Match

For Each Cell In Cells
' Cell.Value retrieves the entire cell reference, e.g.
[dependencytwo.x ml]Sheet1!R1C5
' Cell.Groups("DE P") gets the dependency, e.g. dependencytwo.x ml
'Cell.Groups("S HEET") gets the sheet name, e.g. Sheet1
'Cell.Groups("R OW") gets row number, e.g. 1
'Cell.Groups("C OL") gets column number, e.g. 5
Next Cell

Remember that all tokens are returned as strings.

Jul 21 '05 #2

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

Similar topics

2
2256
by: Nazir | last post by:
Hi I'm using a regular expression validator, but if spaces are entered, it bypasses the validation! I'm using ^{5,100}$
5
4472
by: John . | last post by:
I am using the Regular Expression Validator control to validate a correct email address. But, at the same time I would like to make it a required field. I tested by using just the regular expression validator expecting a message to be displayed but it let me submit the form. Do I have to use both?
1
283
by: jnc | last post by:
I was wondering whether anyone could help me out splitting out the following string (an excel formula) using a regular expression. What I would like to be able to do is get the dependency paths, the sheets names and the rows and columns split into seperate variables. "=Sheet1!R1C1+Sheet1!R1C2"
4
5187
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or adate LIKE "2004.01.10 __:15") .... into something like this: .... where adate LIKE "2004.01.10 __:(30/15)" ...
7
3831
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I want to avoid that. My question here is if there is a way to pass either a memory stream or array of "find", "replace" expressions or any other way to avoid multiple copies of a string. Any help will be highly appreciated
1
10068
by: bobano | last post by:
Hi everyone, I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol. This program can perform 5 options from a menu on your POP3 mail by logging in with the correct POP3 server along with a user name and password that you use to log in to your ISP. The user name and password as well as the server name are all hard-coded...
3
3334
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 requirements is there one command per line. I have always wanted to learn Regular Expressions, so I was hoping I might do this using Regular Expressions. For a fair number of the command will have the syntax like Write( 0x123, 0x12, 25, 100 ) <-...
12
5278
by: TS | last post by:
i have a need to possibly enable mutli language support. What benefit do i get by using a resource file instead of a custom xml solution? thanks!
8
3115
by: Uwe Schmitt | last post by:
Hi, Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Are there any plans to speed up Pythons regular expression module ? Or is the example in this artricle too far from reality ??? Greetings, Uwe
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.