This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

How to read text in front of exact character

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

How to read text in front of exact character

Post by Madalin »

For example i have line

text1 text2 [something] text3 text4 [else] text5

How can i read "text1 text2"
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: How to read text in front of exact character

Post by willyw »

Madalin wrote:For example i have line

text1 text2 [something] text3 text4 [else] text5

How can i read "text1 text2"

In the above, you seem to be asking how to get the first two words.

Yet in the topic:
"How to read text in front of exact character"

So:
Can you give a better example? Is "[something]" relevant, or not?
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Found it .. thanks was looking for something like

Code: Select all

regexp {(.*)\]} $line "" first
there is more work to do after but works.
Post Reply