Search the web
Sign In
New User? Sign Up
textpipe-discuss · TextPipe user discussion forum
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Click here for the latest updates on Groups Message search

Messages

  Messages Help
Advanced
Strange 'Search & Replace' behavior   Topic List   < Prev Topic  |  Next Topic >
Reply < Prev Message  | 
I am trying to extract a relatively simple pattern out of each line
in a file but come up with wierd results. I think I got lucky and
made an expression that works but do not understand why it does not
work in a simpler method. Both methods are below.

SAMPLE:
T01c.001 F001 S40
T02 C.002F002 S40
T03C.003F003 S40
T04 C.004 F004 S40
T05F005c.005 S40
T06 F006 c.006 S40

Perl pattern Search:
t\d+\D*.*c.(\d\d\d\d|\d\d\d|\d\d|\d)\D+.+.$

Replaces with:
C.$1

Output (desired):
C.001
C.002
C.003
C.004
C.005
C.006


I dont understand why the S&R pattern below does not work.

Perl pattern Search:
t\d+\D*.*c.(\d+).*

Replaces with ("-" used to troubleshoot/see capture):
C.-$1-

Output (undesired):
C.-0-01 F001 S40
C.-0-02F002 S40
C.-0-03F003 S40
C.-0-04 F004 S40
C.-0-05 S40
C.-0-06 S40


Please explain why the capture is not getting the whole set of digits
and why the end of the like is not dropping off.

Thanks so much!!






Tue Jul 22, 2003 6:22 pm

nodfs
Offline Offline
Send Email Send Email

< Prev Message  | 
Expand Messages Author Sort by Date

I am trying to extract a relatively simple pattern out of each line in a file but come up with wierd results. I think I got lucky and made an expression that...
nodfs
Offline Send Email
Jul 23, 2003
1:56 am

Just use the pattern c.(\d{1,4}?) With the 'Extract' option on, and a replace pattern of C.$1\r\n Regards, Simon Carter, Crystal Software,...
Simon Carter, Crystal...
crystalsoftw...
Offline Send Email
Jul 23, 2003
7:00 am
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help