473,729 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best design for parse

gs
let say I have to deal with various date format and I am give format string
from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming format
string
a) use two array and statically match
b) use regex to find the order
Jan 6 '07 #1
29 2902
"gs" <gs@dontMail.te lusschrieb:
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming format
string
Maybe you are looking for 'DateTime.Parse Exact'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 6 '07 #2
GS
thank you, I give that a shot Hopefully . it will take care most of what I
need, or at least make the rest easier. except one thing,

I am dealing with lines of string data (up to 300 lines) and the date fields
position may not be known before hand although for a given set of lines,
they stay in the same place 99.999 of the time except for the odd comments
which is not that critical;

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:eT******** ******@TK2MSFTN GP03.phx.gbl...
"gs" <gs@dontMail.te lusschrieb:
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming format
string

Maybe you are looking for 'DateTime.Parse Exact'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 6 '07 #3
GS,

Maybe can you avoid this in 2007 and all things like that as
DateTime.parseE xact, but have a look to the nicely by Microsoft inbuild
globalization and than the to that related ToString option.

Cor

"gs" <gs@dontMail.te lusschreef in bericht
news:Ot******** ******@TK2MSFTN GP03.phx.gbl...
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming format
string
a) use two array and statically match
b) use regex to find the order

Jan 6 '07 #4
GS
thank you, Cor.

However, I must be thick. I don't quite get the drift as with regard to
2007. are we talking about a new release of studio, .net frame work or just
the release or patch to come out in 2007.

how would that handle string date mixed with other data?

Actually the original source of the data is displayed html table placed in
clipboard. the objective to standardize the date string to yyyy-mm-dd and
then pass on to other components for processing and storage

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
GS,

Maybe can you avoid this in 2007 and all things like that as
DateTime.parseE xact, but have a look to the nicely by Microsoft inbuild
globalization and than the to that related ToString option.

Cor

"gs" <gs@dontMail.te lusschreef in bericht
news:Ot******** ******@TK2MSFTN GP03.phx.gbl...
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming format
string
a) use two array and statically match
b) use regex to find the order


Jan 7 '07 #5
GS,

I was thinking about writting that this was not in the case with webpages.
However windowforms is the default in this newsgroup, therefore please tell
this next time.

Cor

"GS" <gs************ **********@msne ws.Nomail.comsc hreef in bericht
news:OI******** *****@TK2MSFTNG P06.phx.gbl...
thank you, Cor.

However, I must be thick. I don't quite get the drift as with regard to
2007. are we talking about a new release of studio, .net frame work or
just
the release or patch to come out in 2007.

how would that handle string date mixed with other data?

Actually the original source of the data is displayed html table placed in
clipboard. the objective to standardize the date string to yyyy-mm-dd and
then pass on to other components for processing and storage

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>GS,

Maybe can you avoid this in 2007 and all things like that as
DateTime.parse Exact, but have a look to the nicely by Microsoft inbuild
globalizatio n and than the to that related ToString option.

Cor

"gs" <gs@dontMail.te lusschreef in bericht
news:Ot******* *******@TK2MSFT NGP03.phx.gbl.. .
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming
format
string
a) use two array and statically match
b) use regex to find the order



Jan 7 '07 #6
It is?

Newsgroup microsoft.publi c.dotnet.langua ges.vb provides a forum for
questions and general discussion of Visual Basic .NET.

Source:
http://msdn.microsoft.com/library/en...rogrammers.asp
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** *********@TK2MS FTNGP02.phx.gbl ...
GS,

I was thinking about writting that this was not in the case with webpages.
However windowforms is the default in this newsgroup, therefore please
tell this next time.

Cor

"GS" <gs************ **********@msne ws.Nomail.comsc hreef in bericht
news:OI******** *****@TK2MSFTNG P06.phx.gbl...
>thank you, Cor.

However, I must be thick. I don't quite get the drift as with regard to
2007. are we talking about a new release of studio, .net frame work or
just
the release or patch to come out in 2007.

how would that handle string date mixed with other data?

Actually the original source of the data is displayed html table placed
in
clipboard. the objective to standardize the date string to yyyy-mm-dd and
then pass on to other components for processing and storage

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******* *********@TK2MS FTNGP06.phx.gbl ...
>>GS,

Maybe can you avoid this in 2007 and all things like that as
DateTime.pars eExact, but have a look to the nicely by Microsoft inbuild
globalizati on and than the to that related ToString option.

Cor

"gs" <gs@dontMail.te lusschreef in bericht
news:Ot****** ********@TK2MSF TNGP03.phx.gbl. ..
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming
format
string
a) use two array and statically match
b) use regex to find the order



Jan 7 '07 #7
GS
the target is actually part of a windows .net application with winform that
embed webbrowser control.

I despite the clipboard source may well be in html table, but I can get the
text. the resulting text will have columns delimited by a couple of space
like characters

I am just in the designing stage to find the an easy to maintain approach
that will yield adequate performance on target PCs.

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** *********@TK2MS FTNGP02.phx.gbl ...
GS,

I was thinking about writting that this was not in the case with webpages.
However windowforms is the default in this newsgroup, therefore please
tell
this next time.

Cor

"GS" <gs************ **********@msne ws.Nomail.comsc hreef in bericht
news:OI******** *****@TK2MSFTNG P06.phx.gbl...
thank you, Cor.

However, I must be thick. I don't quite get the drift as with regard to
2007. are we talking about a new release of studio, .net frame work or
just
the release or patch to come out in 2007.

how would that handle string date mixed with other data?

Actually the original source of the data is displayed html table placed
in
clipboard. the objective to standardize the date string to yyyy-mm-dd
and
then pass on to other components for processing and storage

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
GS,

Maybe can you avoid this in 2007 and all things like that as
DateTime.parseE xact, but have a look to the nicely by Microsoft inbuild
globalization and than the to that related ToString option.

Cor

"gs" <gs@dontMail.te lusschreef in bericht
news:Ot******** ******@TK2MSFTN GP03.phx.gbl...
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming
format
string
a) use two array and statically match
b) use regex to find the order




Jan 7 '07 #8
GS
thanks for all pitched in so far.

let give it another shot.

looks like an easier way out would be
1.copy the date format string regex string holder and then derive the
relevant regex expression to be used for date normalization later in part 2:
replace the regex string the yyyy to regex year expression with year
identifier
look for yy and replace with 20yy and repeat the step above
replace mmm with the month regex expression associated with month
identifier
replace mm with the 2 digit month regex expression associated with month
identifier
replace dd with the 2 digit day regix expression assoc. with day
identifier

2. use the resulting regex in regex replace to normalize to yyyy--mm-dd
any problem with the above approach?

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
GS,

Maybe can you avoid this in 2007 and all things like that as
DateTime.parseE xact, but have a look to the nicely by Microsoft inbuild
globalization and than the to that related ToString option.

Cor

"gs" <gs@dontMail.te lusschreef in bericht
news:Ot******** ******@TK2MSFTN GP03.phx.gbl...
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming format
string
a) use two array and statically match
b) use regex to find the order


Jan 7 '07 #9
Stephany,

You would have seen (you are not a newbie) how much time it took especially
for me, before I got it accepted that the used VB.net language in ASPNET was
also a part of the language and not of the framework and therefore suspect
of this newsgroup. Maybe you even saw that last week I wrote that again in
the C# newsgroup.

I only ask to the OP to tell that if it is specialized on a webpage (what
seems to be not the case) to tell that. Most of the persons answering here
are taking windowsforms as default, and in the case of date times I seldom
ask that, because there is "leiter" no DateTime Value equivalent in HTML.

Cor

"Stephany Young" <noone@localhos tschreef in bericht
news:ut******** ******@TK2MSFTN GP03.phx.gbl...
It is?

Newsgroup microsoft.publi c.dotnet.langua ges.vb provides a forum for
questions and general discussion of Visual Basic .NET.

Source:
http://msdn.microsoft.com/library/en...rogrammers.asp
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** *********@TK2MS FTNGP02.phx.gbl ...
>GS,

I was thinking about writting that this was not in the case with
webpages. However windowforms is the default in this newsgroup, therefore
please tell this next time.

Cor

"GS" <gs************ **********@msne ws.Nomail.comsc hreef in bericht
news:OI******* ******@TK2MSFTN GP06.phx.gbl...
>>thank you, Cor.

However, I must be thick. I don't quite get the drift as with regard to
2007. are we talking about a new release of studio, .net frame work or
just
the release or patch to come out in 2007.

how would that handle string date mixed with other data?

Actually the original source of the data is displayed html table placed
in
clipboard. the objective to standardize the date string to yyyy-mm-dd
and
then pass on to other components for processing and storage

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2****** **********@TK2M SFTNGP06.phx.gb l...
GS,

Maybe can you avoid this in 2007 and all things like that as
DateTime.par seExact, but have a look to the nicely by Microsoft inbuild
globalizatio n and than the to that related ToString option.

Cor

"gs" <gs@dontMail.te lusschreef in bericht
news:Ot***** *********@TK2MS FTNGP03.phx.gbl ...
let say I have to deal with various date format and I am give format
string from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
dd/mm
what is the best way to come up a relevant regex for the incoming
format
string
a) use two array and statically match
b) use regex to find the order





Jan 7 '07 #10

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

Similar topics

12
7718
by: jacob nikom | last post by:
Hi, I would like to store XML files in MySQL. What is the best solution: 1. Convert it to string and store it as CLOB/text 2. Serialize it and store as byte array 3. Flatten it out and create one column per element, each column is VARCHAR Does MySQL has anything special for XML data? Is there any software which helps to store XML data in MySQL
7
3011
by: Shimon Sim | last post by:
I have a custom composite control I have following property
3
2099
by: danavni | last post by:
i need to build a service that will accept incoming TCP/IP connections. the service should act like a "HUB" where on one side clients connect to it and stay connected for as long as they like and on the other side the service reads messages for these clients from MSMQ and sends them to already connected clients. the clients can also send information back to the "HUB" which will be parsed and sent to MSMQ. when the clients connect to this...
10
1982
by: Mike Logan | last post by:
I am using the "contract first" design methodology. Contract First is design the WSDL first then design the server and client. However I must design my XSD/XML Schema before anything. I am developing my schema now. I have a version on my schema. However once I start the server side code, how is the server now that the right "complexType" is being passed? What happens if this complexType my web service consumes needs to be...
3
2163
by: aurora | last post by:
This is an entry I just added to ASPN. It is a somewhat novel technique I have employed quite successfully in my code. I repost it here for more explosure and discussions. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475158 wy ------------------------------------------------------------------------
1
1633
by: Bernie Beattie | last post by:
I'm really struggling with deciding on the best way to approach my particular website design scenario. Most tutorials and samples assume an sql backend database. What I have is a proprietary database (which I'm stuck with) that I communicate with via a dll which expects requests in xml and returns the data back in xml. I've initially created a generic data access class that has 2 string parameters containing the dll method to call and...
4
1583
by: =?ISO-8859-15?Q?Luigi_Malag=F2?= | last post by:
Hello, i'm new to function pointers. I have some code that parses some configuration files using flex and bison. I have to use the same parse for different files, but the information i parse have to be add to different collections. I have a C++ class that wraps the code that invoce the parser. I pass to the parser an object that works as a container for the different object i have to parse. Let make an example. I have to parse men.txt...
1
1818
by: Olaf | last post by:
Hi, I try to design a program which has to run on console. There is only one exe/binary and depend on the calling name argv the different tasks/commands should be performed as aliases. It's the technique by busybox or linux lvm tools in C and avoids a bunch of different binaries. Now I want to write those using C++ classes and boost. Ok, now I'm in design considerations. I have problems with the API for this purpose.
4
1530
by: trullock | last post by:
Hi, Can anyone suggest the best way to go about the following... I'm tracking clicks (mouse down x,y coordinates) on a web page by using some javascript to create an XHR which sends the coordinates to a recording service, such as: /Record.ashx?X=123&Y=456
0
9426
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...
0
9280
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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
9142
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
8144
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...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
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
3
2162
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.