RFC for regex object builtin (was Re: Question about CWM)

--- Dominique Hazaël-Massieux <dom@w3.org> wrote:
> Le mar 26/08/2003 à 11:20, James Michael DuPont a écrit :
> > 1. how is it possible to do sedlike "s/_/-/g" type
> > replacements on
> > strings? I am using the string:scrape any way to just scrap and
> concat
> > each part that matches a pattern?
> 
> I don't know...

What do you all think about making the followin builtins for CWM :


# myregex is a search and replace thingie
:myregex a regex:search-replace.

# look for foo
:myrefex regex:search-for      "foo*".
:myrefex regex:search-for      "baz".

# repleace with bar
:myrefex regex:replace  "bar".

# store the result in :result
:myrefex regex:result          :result.

# prepare input 
:var foo:name :input.

# apply to the varible :input
:myregex regex:apply :input.

#store the first result to :result-var
:result regex:match-1 :result-val;
:result regex:match-2 :result-val2;

how does that sound ? 

> 
> > 2. How can i convert an string to an uri? 
> > i would like to take "<http://goo.foo.com/bar/baz#>" and convert it
> to
> > the  uri <http://goo.foo.com/bar/baz#>. Any ideas?
> 
> AFAIK, log:uri does that (but without the < >), e.g.
> :toto log:uri "http://example.org/foobar#"

How about a new built in for that ?
   log:uri-absolute
that  will emit "<http://example.org/foobar#>"

   log:uri-prefixed
that  will emit "foo:"
if foo: is 
@prefix foo: <http://example.org/foobar#>

Any comments?

mike


=====
James Michael DuPont
http://introspector.sourceforge.net/

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Received on Thursday, 28 August 2003 09:26:07 UTC