Using a dot in replace()

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

PJCarr
Ebase User
Posts: 5
Joined: Wed Oct 01, 2008 10:48 am

Using a dot in replace()

#1

Postby PJCarr » Wed Nov 19, 2008 11:32 am

It seems that using a dot character, following another character e.g. ',.' in a replace function replaces all instances of the first character plus the one following it.

so if field2 = 'line1, line2, line3,.line4'

Code: Select all

set field1 = replace(field2, ',.', '.') ;
sets field1 to 'line1.line2.line3.line4' and not the intended 'line1, line2, line3.line4'

Also

Code: Select all

set field1 = replace(field2, ',\.', '.') ;
(verify actually complains at this but the code still runs).

doesn't give 'line1, line2, line3.line4'
but
'line1.line2.line3.line4' as before.

So, how do you replace ',.' with '.' using the replace function?

Is this a feature, bug or unintended consequence?

Any and all help appreciated.
0 x

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Using a dot in replace()

#2

Postby AJDulk » Wed Nov 19, 2008 12:50 pm

You need to use Regular Expression syntax. Thus

Code: Select all

set field1 = replace(field2, ',.', '.') ;
becomes

Code: Select all

set field1 = replace(field2, ',[.]', '.') ;
Regards,
Antony
0 x

PJCarr
Ebase User
Posts: 5
Joined: Wed Oct 01, 2008 10:48 am

Regular expression sysntax

#3

Postby PJCarr » Wed Nov 19, 2008 1:06 pm

AJDulk - thanks for the reply. :)

Do you know if this is documented anywhere?

What else can one do with it?
0 x

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Regular expression syntax

#4

Postby AJDulk » Wed Nov 19, 2008 1:12 pm

For a general description see the Regular Expression article on Wikipedia. There are various links available in the article, including one to Regular Expression Examples.

For even more reading, do a search in your favourite search engine.

Regards,
Antony
0 x

PJCarr
Ebase User
Posts: 5
Joined: Wed Oct 01, 2008 10:48 am

#5

Postby PJCarr » Wed Nov 19, 2008 1:18 pm

Antony,

I should have been more specfic. :roll: What I meant was is this documented anywhere within ebase and which bits of RE can be used within replace().

It's nicer to have this stuff documented than waste time experimenting ...

Perhaps one of the Ebase team could enlighten me?
0 x

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Regular expression syntax

#6

Postby AJDulk » Wed Nov 19, 2008 1:42 pm

Ah, okay.

The only documentation I can find in Ebase about Regular Expressions is the System Validators section of the documentation (.../doc/validators.htm). It is, frankly, a very basic summary.

I am interested to see what light our friends at Ebase can throw on the subject.

Regards,
Antony
0 x


Who is online

Users browsing this forum: No registered users and 111 guests