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

Regular Expressions: Named groups in VBA

Hi,

Is it possible to used named groups in VBAs version of Regular Expressions (Regexp)

Example match groups for extracting dates from strings:

(?:(\d{2})\.(\d{2})\.(\d{4})\s(\d{2}):(\d{2}):(\d{ 2}))|(?:(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2})

will returns DD.MM.YYYY or YYYY-MM-DD in submatch groups but the ordering is mixed up depending on the formatting.

A better solution would be:

(?:(?<Day>\d{2})\.(?<Mon>\d{2})\.(?<Yr>\d{4})\s(?< hh>\d{2}):(?<mm>\d{2}):(?<ss>\d{2}))|(?:(?<Yr>\d{4 })-(?<Mon>\d{2})-(?<Day>\d{2})\s(?<hh>\d{2}):(?<mm>\d{2}):(?<ss>\d{ 2}))

Which names the groups using the <name> method.

These strings work fine in VB.net but not in VBA???

Thanks,

Mark
Oct 24 '10 #1
0 1115

Sign in to post your reply or Sign up for a free account.

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...
11
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
2
by: Carlos Guzmán Álvarez | last post by:
Hello: I need to extract named parameters from a SQL command using regular expressions, for example: select * from TEST_TABLE_01 where VARCHAR_FIELD = @varchar_field or CHAR_FIELD =...
4
by: Ben Dewey | last post by:
Hey, I have only been playing with regular expressions for some time. I am working on some code that parses and object 560 event log. I have created two expressions the first one which works...
4
by: Higgim Batham | last post by:
Is there any efficient way to get the data from the following string using the regular expressions? Dim strTestData as String = "CST123CENTST7872828TENFST1234FEN" In the case I am...
8
by: P K | last post by:
I have an XML in which I have to comment out the <responseopt> tag the tags between this tag should not be commented I plan to use regular expressions The tags looks like this <responseopt...
3
by: Chris | last post by:
Hi everyone, I'm trying to parse through the contents of some text files with regular expressions, but am new to regular expressions and how to use them in VB.net. I'm pretty sure that the...
2
by: Neil Cerutti | last post by:
A found some clues on lexing using the re module in Python in an article by Martin L÷wis. http://www.python.org/community/sigs/retired/parser-sig/towards-standard/ He writes: A scanner...
10
by: supercrossking | last post by:
I am trying to the values of string of text in the sample before. The ds are for digits and s is for string and string of text is for a string with more than one or two values. I am trying to use...
4
by: DomoChan | last post by:
When I attempt to name a group in a regular expression under TR1, the library throws a non descriptive error "regular expression error". The numbered reference group works, as in /1 to reference...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...

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.