#47715 - 05/02/14 03:29 PM
Re: Removing text
[Re: Bill D]
|
OL Newbie
Registered: 04/29/14
Posts: 16
|
Wow, Excellent! Thanks for the solution and explanation I have added another term from what I learned. One follow up is can a modification of the code above replace text the follows for an entire line? If I find -UC it will replace the text that follows in that selection area? Much appreciate.
|
Top
|
|
|
|
#47720 - 05/02/14 05:15 PM
Re: Removing text
[Re: Bill D]
|
OL Newbie
Registered: 04/29/14
Posts: 16
|
I did read through the help and couldn't find it. Let me ask another way. Is there a wildcard within Press Talk? Something that I can put in the string to say find '-UC(and anything else following)' ? I know in Excel it would be * for any characters after and ? for a single character. On nesting terms can I nest in searching another smaller range within the string? Below I attempted to have a 4th stingreplace in a narrower selection only two columns for '-U' I obviously missed something. PTK0083
=stringreplace(@(¤t.line,15,16)stringreplace(stringreplace(stringreplace(@(¤t.line,2,16), '-UC',''),' COM',''), ' KNO','') , '-U','')
Sorry to be so high maintenance, I really do appreciate all the help.
|
Top
|
|
|
|
#47729 - 05/05/14 12:37 PM
Re: Removing text
[Re: Bill D]
|
Benoit Potvin
Unregistered
|
The @(¤t.line,15,16) should be removed. =stringreplace(stringreplace(stringreplace(stringreplace(@(¤t.line,2,16), '-UC',''),' COM',''), ' KNO','') , '-U','') This removes '-U', ' KNO', ' COM' and '-UC' from @(¤t.line,2,16) For the wildcard question, there's no such wildcard in PlanetPress Talk, but there is an advanded Search and replace plug-in in PlanetPress Workflow that accepts regular expressions. Hope this helps
Edited by Benoit Potvin (05/05/14 12:40 PM)
|
Top
|
|
|
|
#47730 - 05/05/14 01:34 PM
Re: Removing text
[Re: Bill D]
|
OL Newbie
Registered: 04/29/14
Posts: 16
|
So there is no way to do a multiple replace with a smaller selection? Do the replace for the first three and have the last search only look in columns 15,16?
The situation I have is that between 2-16 is my part# now if it is a special order then '-UC' will print at the end. But the column is fixed length, so if a # happens to be 13 characters long it will only print '-U' and it would only happen in those last two columns and i would only want to remove '-U' from there because it was to be be in columns 2-14 I wouldn't want it to be changed.
Again thanks for the all the time and help with this.
|
Top
|
|
|
|
#47731 - 05/05/14 03:38 PM
Re: Removing text
[Re: Bill D]
|
Benoit Potvin
Unregistered
|
Hi Bill, So there is no way to do a multiple replace with a smaller selection? Do the replace for the first three and have the last search only look in columns 15,16? yes this is possible. Sorry I misunderstood the goal. You could do it using the mid function. Here is how I decomposed the expression because its more complex than just a bunch of stringreplace nested together: 1. A = characters 2 to 16, minus any occurence of '-UC', ' COM' and ' KNO': &A := stringreplace(stringreplace(stringreplace(@(¤t.line,2,16), '-UC',''),' COM',''), ' KNO','') 2. B= first 13 characters of &A: &B := mid(&A, 1,13) 3. C= characters 15 and 16 from A (may be empty) &C := mid(&A, 14,2) 4. D= C minus any occurence of '-U': &D := stringreplace(&C,'-U','') 5. E = the string we want. &E := &B + &D ------------------- or, in 1 expression:
=mid(stringreplace(stringreplace(stringreplace(@(¤t.line,2,16), '-UC',''),' COM',''), ' KNO',''),1,13)+stringreplace(mid(stringreplace(stringreplace(stringreplace(@(¤t.line,2,16), '-UC',''),' COM',''), ' KNO',''),14,2), '-U', '')
so a data file with this:
123456789012345
1234567890123-U
123456789012-UC
12345678901 COM
12345678901 KNO
1234567-U 123-U
12345678901-U-U
123456-UC0 KNO5
would result with this being displayed:
123456789012345
1234567890123
123456789012
12345678901
12345678901
1234567-U 123
12345678901-U
12345605
Hope this helps!
Edited by Benoit Potvin (05/06/14 10:10 AM)
|
Top
|
|
|
|
#47738 - 05/06/14 10:04 AM
Re: Removing text
[Re: Bill D]
|
OL Newbie
Registered: 04/29/14
Posts: 16
|
Thanks for the explanation along with the solution! This is great.
|
Top
|
|
|
|
#47918 - 05/15/14 02:38 PM
Re: Removing text
[Re: Bill D]
|
OL Newbie
Registered: 04/29/14
Posts: 16
|
Is there a way to apply a line condition to this solution? With help I have created a function that skips lines of text if they meet criteria, Right now it is just showing a blank like I would like to not show the blank and collapse them but I cannot apply the line condition to this box. The option for line condition is grayed out either from the custom selection or the repeat. Thanks.
|
Top
|
|
|
|
|
|