string->replace using regexp : how?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

string->replace using regexp : how?

Duncan S Kincaid
i am bloody embarrassed to ask this question, but how the devil does one use regexp with string->replace?

for a silly example, i wish to return the substring preceding  the first ‘.’ (this would be ’33’ in the example below).

local(boo = ’33.444.5555’)
#boo->replace(`\..*$`,’’)
#boo
>> 33.444.5555

the regexp is correct, but i do not (evidently) know how to embed it into the ->replace method. back ticks? no. parens? no.

i alway send up using ‘string_findRegExp’ or ‘string_replaceRegExp’ but would like to learn how to do it directly from ->replace method.

with thanks!
dk


Duncan Kincaid
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cron | mit school of architecture and planning




#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: string->replace using regexp : how?

Jolle Carlestam-2
28 apr. 2017 kl. 01:11 skrev Duncan S Kincaid <[hidden email]>:
>
> i am bloody embarrassed to ask this question, but how the devil does one use regexp with string->replace?
>
> for a silly example, i wish to return the substring preceding  the first ‘.’ (this would be ’33’ in the example below).
>
> local(boo = ’33.444.5555’)
> #boo->replace(`\..*$`,’’)
> #boo
>>


local(boo = '33.444.5555')
#boo->replace(regexp(`\..*$`),'')
#boo


HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: string->replace using regexp : how?

Duncan S Kincaid
ok, i did say it was a silly question.
and i *am* embarrassed.
but also enormously grateful.

thanks much Jolle!

ciao
dk

> On Apr 27, 2017, at 7:17 PM, Jolle Carlestam <[hidden email]> wrote:
>
> 28 apr. 2017 kl. 01:11 skrev Duncan S Kincaid <[hidden email]>:
>>
>> i am bloody embarrassed to ask this question, but how the devil does one use regexp with string->replace?
>>
>> for a silly example, i wish to return the substring preceding  the first ‘.’ (this would be ’33’ in the example below).
>>
>> local(boo = ’33.444.5555’)
>> #boo->replace(`\..*$`,’’)
>> #boo
>>>
>
>
> local(boo = '33.444.5555')
> #boo->replace(regexp(`\..*$`),'')
> #boo
>
>
> HDB
> Jolle
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: string->replace using regexp : how?

Jolle Carlestam-2
28 apr. 2017 kl. 01:24 skrev Duncan S Kincaid <[hidden email]>:
>
> ok, i did say it was a silly question.
> and i *am* embarrassed.

No such thing as silly questions. Glad I could help.

HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Loading...