I have some variable wings in TCL that come from some input text file. They are too much ... some things look like this: What type of face do you want to face:
A1 = LP 89 SLCAT.71300.0A2 = LP89SL . CAT 28742.0 A3 = LP89 SLCAT -271300.0 A3 = LP 89 SLC .AT2-0.260-0.085
Everyone has the string ( {...} + {AT2 } + {...}
is the same part in the middle) ==> ( .AT2
) I want to delete a right part which is next to that (. For example:
A1 = LP89slc.AT271300.0 ==> LP89 SLCAT2A2 = L P 89 SLCAT2-71300.0 ==> LP89 SLCAT2
I also want to know that I can remove the last part of a string that comes in front of special character. Like ... AT2 ... For example: To change the unexpected variable set such as {SomeCharecter.At2UniversisablePart}, change it to {SomeCharecter.At2}
The difference between this question and the first one It is that, the first position, the first part is limited and unassignable. But in the second question, the two parts that come to the left and right places of {AT2} are unpredictable.
trim
trimright
trimleft
commands do not work for me!
The easiest way to perform a regular expression is to replace:
regsub -all -line {^. * \ Y (\ w + \ .2 AT2). * $} $ TheString {\ 1} theString
The hard bits here -line
option (which applies to a multi-line string) and \ Y
in a regular expression (that matches the start or end) of one word - in this case it is beginning because a \ w
has to be made to the next match).
No comments:
Post a Comment