Wrox Programmer Forums
|
BOOK: Beginning Regular Expressions
This is the forum to discuss the Wrox book Beginning Regular Expressions by Andrew Watt; ISBN: 9780764574894
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Regular Expressions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 9th, 2006, 08:44 AM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I stop repeated words

Ladies and Gentlemen,
Your help please.
I'm new to regular expressions. I have read about them and tested a few, so I'm convinced this is the way to go. :)

I have is a large (file) document that has repeated text (tokens) in it. These repeated tokens(text) are not the same in consecutive documents. The tokens always have an underscore in them and they are always uppercase. However, I need to display the first occurrence of each token into a listbox. The trouble is, I always get the repeats in my list box. :(
Clearly, I need some sort of 'repeat limiter' in my expression.
Code:
([A-Z]+(_)[A-Z_;]+[0-9]+)
Here is an example of some tokens I need to find:
Code:
SYS_IDTN;3;CCD;EVENT_TIME;8;14585900;JOB_NUM;6;DUJ748;SYS_IDTN;3;DCD;;EVENT_TIME;8;15052300;
As you can see the tokens are starting to repeat. My expression doesn't stop this.
Any ideas?
 
Old September 8th, 2006, 03:04 AM
Registered User
 
Join Date: Sep 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

 I'm master of Perl regex. :-) Do you use Perl? May be this regex help you?
([A-Z]+(_)[A-Z_;]+[0-9]+).*$


Regards,
Serge
http://www.gameintellect.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop button won't stop loop JDShaffer Visual Basic 2008 Essentials 3 May 23rd, 2008 03:22 PM
Dataset repeated values Narts C# 1 November 23rd, 2007 10:31 AM
matches without repeated items pongup BOOK: Beginning Regular Expressions 0 April 7th, 2007 09:05 PM
An error that has been repeated many times over Giuda BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 October 31st, 2006 06:05 PM
Excecuting repeated code every one second maxpotters Excel VBA 6 March 6th, 2005 06:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.