From: Kevin Walzer on 5 Jul 2010 17:16 Hello all, I'm trying to create a regex to match Twitter usenames (@username): I also need this regex to exclude e-mail addresses. I'm using this regex currently: {@([A-Za-z0-9_]+)} which matches the following: @foo @foo: LOL u r gr8 bar(a)foo.com I want to match the first two, but not the third. Any advice? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com
From: Andreas Leitgeb on 5 Jul 2010 17:27 Kevin Walzer <kw(a)codebykevin.com> wrote: > I'm using this regex currently: > {@([A-Za-z0-9_]+)} > @foo > @foo: LOL u r gr8 > bar(a)foo.com > I want to match the first two, but not the third. Any advice? use: {^@([A-Za-z0-9_]+)}
From: Gerald W. Lester on 5 Jul 2010 17:31 Kevin Walzer wrote: > Hello all, > > I'm trying to create a regex to match Twitter usenames (@username): I > also need this regex to exclude e-mail addresses. > > I'm using this regex currently: > > {@([A-Za-z0-9_]+)} > > which matches the following: > > @foo > > @foo: LOL u r gr8 > > bar(a)foo.com > > I want to match the first two, but not the third. Any advice? I'd not use regex but rather: string match -nocase {@*} $testCase I think it is much more readable. -- +------------------------------------------------------------------------+ | Gerald W. Lester, President, KNG Consulting LLC | | Email: Gerald.Lester(a)kng-consulting.net | +------------------------------------------------------------------------+
|
Pages: 1 Prev: snit question Next: ActiveTCL/Tablelist broken - still no solution |