String & delimit
Gregor Kopp
gk at cutcopy.com
Wed Apr 4 00:55:52 PDT 2007
Dan schrieb:
> In JavaScript, I think I write it something like:
>
> "blablabla thisis a string example <i_need_this_text> ole!".match(
> /<([^>]+)>/m)[1];
>
I converted your pattern to a small d program:
---begin
import std.stdio;
import std.regexp;
void main()
{
auto s = "blablabla thisis a string example <i_need_this_text> ole!";
auto m = std.regexp.search(s, "<([^>]+)>");
if (m) writefln("%s", m.match(0));
}
---end
which prints <i_need_this_text>
I don't have time to take a closer look at your pattern so that it
prints only i_need_this_text. I always get headache on Regexp ;)
greets, Gregor
ps.: have found it at [1] and [2]
[1] http://www.digitalmars.com/d/regular-expression.html
[2] http://www.digitalmars.com/d/phobos/std_regexp.html
More information about the Digitalmars-d
mailing list