RexEx in Methods

Ivan Smahin ivan_smahin at paradigmasoft.com
Thu Apr 3 09:16:20 CDT 2008


Hello Justin,

Thursday, April 3, 2008, 4:54:38 PM, you wrote:

> Hello everyone, here is what i'm trying to do.

> I have a string field 'FieldName' that contains string like
> 'test_string'
> 'test.string'

> I want to create a method field that is indexed by words but it
> appears that the characters _ and . (and others) aren't used as word breaks.

> So i thought I'd create a regex expression for the method text

> FieldName regex '[_.@]' and perhaps replace all occurrences with a space.

> This doesn't seem possible

> short of doing
> replace(replace(replace(FieldName,'_',' '),'.',' '),'@',' ') for
> every character I want to replace, is there any other way of doing what i'm trying to accomplish?

> Thanks!

So you want modify field 'FieldName' with values like
'test string'
'test string'

instead of

'test_string'
'test.string'

Right?

What about just a couple of updates?
update t1 set FieldName = replace( FieldName, '_', ' ' );
update t1 set FieldName = replace( FieldName, '.', ' ' );

actually you can do it in a single hop:
update t1 set FieldName = replace( replace( FieldName, '.', ' ' ), '_', ' ' );

-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list