RegEx Support in Ensemble

43 views
Skip to first unread message

Viraj

unread,
Jul 11, 2011, 8:38:24 AM7/11/11
to InterSystems: Ensemble in Healthcare
Hi,
I need to know if ensemble supports regex just like java or .net. I
need to do some string manipulations using regex in ensemble.

Ricardo Santos

unread,
Jul 11, 2011, 9:20:37 AM7/11/11
to ensemble-in...@googlegroups.com

Hi Viraj,

I've been using pattern matching in Ensemble to achieve some of what
regular expressions do in other languages, though not as powerful as a
full regular expression implementation.
You can read more about it here:
http://docs.intersystems.com/ens20102/csp/docbook/DocBook.UI.Page.cls?KEY=G
COS_operators#GCOS_operators_pattern

Hope this helps!

Ricardo

>--
>You received this message because you are subscribed to the Google Groups
>"InterSystems: Ensemble in Healthcare Community" group.
>To post to this group, send email to
>Ensemble-in...@googlegroups.com
>To unsubscribe from this group, send email to
>Ensemble-in-Healt...@googlegroups.com
>For more options, visit this group at
>http://groups.google.com/group/Ensemble-in-Healthcare?hl=en

Robert Hickingbotham

unread,
Jul 18, 2011, 11:05:06 AM7/18/11
to ensemble-in...@googlegroups.com
Hi Viraj

I have been working on a regular expression object which is near enough ready for you to have if it works for you. The following code snippet gives a feel for how it is used.

USER>set re=##class(Library.RegExp).%New()
USER>do re.Compile("[^!@\s]+@(([a-zA-Z0-9\-]+)\.)+([a-zA-Z0-9]+)","gi")
USER>set re.input="address1: mai...@domain.com address2: i...@yahoo.co.uk"
USER>write re.Execute()
1
USER>write re.lastMatch
mai...@domain.com
USER>w re.savedStrings.GetAt(2)
domain.
USER>write re.Execute()
1
USER>write re.lastMatch
i...@yahoo.co.uk

If you would like it then let me know which version of Ensemble you are running.

Best regards
Robert Hickingbotham

> --
> You received this message because you are subscribed to the Google
> Groups "InterSystems: Ensemble in Healthcare Community" group.

> To post to this group, send email to Ensemble-in-
> Healt...@googlegroups.com
> To unsubscribe from this group, send email to Ensemble-in-Healthcare-
> unsub...@googlegroups.com

Viraj

unread,
Jul 25, 2011, 7:12:29 AM7/25/11
to InterSystems: Ensemble in Healthcare
Hi All,
Thanks for your replies.
Robert, I tried your code to initiate a new RegExp object but looks
like ensebmle does not support it. I also checked the documentation of
ensemble.
I am using ensemble v2010.2

Thanks

On Jul 18, 8:05 pm, Robert Hickingbotham
> >http://groups.google.com/group/Ensemble-in-Healthcare?hl=en- Hide quoted text -
>
> - Show quoted text -

Robert Hickingbotham

unread,
Jul 25, 2011, 9:22:05 AM7/25/11
to ensemble-in...@googlegroups.com, InterSystems: Ensemble in Healthcare
Hi Viraj

Library.RegExp is a custom object written by myself and is not
supported by InterSystems. I am happy to send you the code for you to
import and use on your Ensemble instance if you wish.

Best regards

Robert Hickingbotham

Sent from my iPhone

> To post to this group, send email to Ensemble-in...@googlegroups.com
> To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com

Reply all
Reply to author
Forward
0 new messages