Dear Friends,
In my web application i have two textboxes to collect "ORIGIN" and
"DESTINATION" stations. These stations are represented as three letter
code.. We have an option like to provide multiple stations as seperated
by comma(,) or slash(/) operator.
Example Data
Origin BOM, DEL,AUH
Destination LON,BKK
Now the requirement is,
a) Duplicate stations are not allowed in Origin and Destination fields.
Ex.. Origin - BOM, BOM, DEL, AUH, Del
b) Same Stations are not allowed in both Origin and Destination
Ex.. Origin - BOM, DEL, AUH
Destination - AUH, LON, BKK
I hope, it is possible with Regular expressions. But i don't have idea
about how to achieve using regular expression.
Please advice me to solve the issue using regular expression or some
other way.
Regards,
Prakash 2 1807
Prakash wrote:
Dear Friends,
In my web application i have two textboxes to collect "ORIGIN" and
"DESTINATION" stations. These stations are represented as three letter
code.. We have an option like to provide multiple stations as
seperated by comma(,) or slash(/) operator.
Example Data
Origin BOM, DEL,AUH
Destination LON,BKK
Now the requirement is,
a) Duplicate stations are not allowed in Origin and Destination
fields. Ex.. Origin - BOM, BOM, DEL, AUH, Del
b) Same Stations are not allowed in both Origin and Destination
Ex.. Origin - BOM, DEL, AUH
Destination - AUH, LON, BKK
I hope, it is possible with Regular expressions. But i don't have idea
about how to achieve using regular expression.
Please advice me to solve the issue using regular expression or some
other way.
Regular Expressions are expressions to identify parts in a string and
eventually change them with teh rudimentary functions build into
regex's.
So the best thing you can do I think is use a regex to get all the
3-letter codes and use a hashtable to check if a match is already in
the list or not (add a found match to the keys of the hashtable with a
value null and you can fast check if a 3-letter match has been found by
simply call ContainsKey)
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Thanks FB
On Nov 2, 12:09 pm, "Frans Bouma [C# MVP]"
<perseus.usenetNOS...@xs4all.nlwrote:
Prakash wrote:
Dear Friends,
In my web application i have two textboxes to collect "ORIGIN" and
"DESTINATION" stations. These stations are represented as three letter
code.. We have an option like to provide multiple stations as
seperated by comma(,) or slash(/) operator.
Example Data
Origin BOM, DEL,AUH
Destination LON,BKK
Now the requirement is,
a) Duplicate stations are not allowed in Origin and Destination
fields. Ex.. Origin - BOM, BOM, DEL, AUH, Del
b) Same Stations are not allowed in both Origin and Destination
Ex.. Origin - BOM, DEL, AUH
Destination - AUH, LON, BKK
I hope, it is possible with Regular expressions. But i don't have idea
about how to achieve using regular expression.
Please advice me to solve the issue using regular expression or some
other way. Regular Expressions are expressions to identify parts in a string and
eventually change them with teh rudimentary functions build into
regex's.
So the best thing you can do I think is use a regex to get all the
3-letter codes and use a hashtable to check if a match is already in
the list or not (add a found match to the keys of the hashtable with a
value null and you can fast check if a 3-letter match has been found by
simply call ContainsKey)
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website:http://www.llblgen.com
My .NET blog:http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------- Hide quoted text -- Show quoted text -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: Neri |
last post by:
Some document processing program I write has to deal with documents
that have headers and footers that are unnecessary for the main
processing part. Therefore, I'm using a regular expression to go...
|
by: Joe |
last post by:
Hi,
I have been using a regular expression that I don’t uite understand to
filter the valid email address. My regular expression is as follows:
<asp:RegularExpressionValidator...
|
by: Q. John Chen |
last post by:
I have Vidation Controls
First One: Simple exluce certain special characters:
say no a or b or c in the string:
*
Second One:
I required date be entered in "MM/DD/YYYY" format:
//+4 How...
|
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...
|
by: Lucky |
last post by:
hi guys,
i'm practising regular expression. i've got one string and i want it to
split in groups.
i was trying to make one regular expression but i didn't successed.
please help me guys.
i'm...
|
by: Mike |
last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in
matches. I would like to get what the actual regular expression is.
In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
|
by: deepak_kamath_n |
last post by:
Hello,
I am relatively new to the world of regex and require some help in
forming a regular expression to achieve the following:
I have an input stream similar to:
Slot: slot1
Description:...
|
by: Chris |
last post by:
I need a pattern that matches a string that has the same number of '('
as ')':
findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) =
Can anybody help me out?
Thanks for any help!
|
by: Allan Ebdrup |
last post by:
I have a dynamic list of regular expressions, the expressions don't change
very often but they can change. And I have a single string that I want to
match the regular expressions against and find...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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: 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,...
|
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...
|
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: 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...
|
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...
| |