LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2012, 02:41 PM   #1
lkraemer
Member
 
Registered: Aug 2008
Posts: 113

Rep: Reputation: 10
Python Regular Expression for use with Meld


I'm in need of a Python Regular Expression to use with Meld.

My CSV file contains text lines typical of the following ID information that I want to
hide while I compare two files. One problem is there is one, two or three sets of data
on some lines, while others may have none.
lines.

TYPICAL DATA I want to EXCLUDE: (Three samples extracted from one file)
Code:
[I38804]
[I11796]
[I13714]
[I13715]
[I1533]
[I16552]
[I17848]
[I24814]

[F4971]	[I12972]	[I12949]
[F4972]	[I12973]	[I12969]
[F4973]	[I12970]	[I12975]
[F4974]	[I12971]	[I12976]
[F4975]	[I12265]	[I12990]
[F4976]	[I12991]	
[F4977]	[I12995]	[I12994]
[F4978]	[I12999]	[I13000]
[F4979]	[I13001]	[I12787]
[F4980]	[I13004]	[I13003]

[F2071]	[I5574]
[F2071]	[I5575]
[F2071]	[I5576]
[F2072]	[I5578]
[F2072]	[I5579]
[F2073]	[I28646]
[F2073]	[I28647]
[F2076]	[I28636]
[F2077]	[I5585]
[F2077]	[I5586]
The Data is an Exported CSV file with headers for Columns A, B, & C.

...A...........B.........C.....
Person Surname Given

Is there a GURU on RE out there that would help a beginner on RE's?

I've Googled, read the information on:
http://docs.python.org/2/library/re.html
about 10 times but I can't get it working.

I've tried ^([.*])* but, that didn't work. Also tried ^\[*?\]* but no luck there either.

I'd appreciate any help you could give.

Thanks.

Larry

Last edited by lkraemer; 12-19-2012 at 08:05 PM.
 
Old 12-19-2012, 03:03 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
I'm not a python user, so I may not be able to help you directly, but I do think you should clarify your request a bit more. I'm a bit confused by it.

To start with, please use ***[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.

Second, I think we need to see three things: the input text, the exclude text, and the final result of processing the two together. For example, do you want to remove each individual entry no matter how many there are on the line, or only if the whole line matches, or what?

How exactly do the exclude entries match to the input?
 
Old 12-19-2012, 08:08 PM   #3
lkraemer
Member
 
Registered: Aug 2008
Posts: 113

Original Poster
Rep: Reputation: 10
Thanks for your response. I finally got the RE correct, but it didn't help me compare the files, because while the
Person, Surname, and Given IDENTIFICATION NUMBERS were mask out so the Text Data was comparing the Other information
that was linked to the ID Numbers wasn't associated.

So, I gave up trying to do my compares that way.

Thanks.

Larry.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python replace() with regular expression ! noony123 Programming 1 03-16-2011 03:58 AM
[SOLVED] Regular expression to match URL matches fragments - Python madsovenielsen Programming 4 08-29-2010 09:44 AM
[SOLVED] Python regular expression, cant get it to work madsovenielsen Programming 2 08-23-2010 09:54 PM
[SOLVED] Regular expression working fine in JavaScript but not in python madsovenielsen Programming 3 06-24-2010 07:25 PM
Python - need help narrowing a regular expression rose_bud4201 Programming 2 10-30-2005 12:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration