Hi,
are regular expressions possible in the Team Developer?
The In-Build-Help does have an article about them, so I'd suppose it is. But how can I use them?
Does anyone have experience with them? Can I use them with f.ex. SalStrScan() ? If so, how to I tell TD it's a RegEx?
I need them for searching within strings and also for replacing. Regular expressions are so useful, I really hope they are usable!
Thanks for any help!
P.S. I use TD 6.1 right now but we will upgrade to TD 6.2 at some time.
Are there Regular Expressions in TD?
Re: Are there Regular Expressions in TD?
Hi,
well it seems that no one has ever used Regex in TD.
So there might be another way to execute advanced string search/replacements?
So if I f.exp. search for a 4 character long string starting with "abc" and then following either a 1, a 2 or a 3 would it be
If SalStrScan( sTmp, 'abc') = 0 AND SalStrLength(sTmp) = 4 AND ( SalStrScan( sTmp, '1') = 3 OR SalStrScan( sTmp, '2') = 3 OR SalStrScan( sTmp, '3') = 3)
Any idea how to do it shorter?
And what if not a number but another letter might follow, but NOT a number? Do I have to give 24 choices (respective 10 negative choices for numbers)?
I've seen you can use _ for any character (% for any number of characters), but how to distinguish between number and letters? There should be a way, shouldn't there?
Thanks a lot for any input!
well it seems that no one has ever used Regex in TD.
So there might be another way to execute advanced string search/replacements?
So if I f.exp. search for a 4 character long string starting with "abc" and then following either a 1, a 2 or a 3 would it be
If SalStrScan( sTmp, 'abc') = 0 AND SalStrLength(sTmp) = 4 AND ( SalStrScan( sTmp, '1') = 3 OR SalStrScan( sTmp, '2') = 3 OR SalStrScan( sTmp, '3') = 3)
Any idea how to do it shorter?
And what if not a number but another letter might follow, but NOT a number? Do I have to give 24 choices (respective 10 negative choices for numbers)?
I've seen you can use _ for any character (% for any number of characters), but how to distinguish between number and letters? There should be a way, shouldn't there?
Thanks a lot for any input!
Re: Are there Regular Expressions in TD?
AFAIK there is no build in RegEx in TD. As we're using Oracle as RDBMS, I'm sometimes using SQL for this kind of problems. Maybe thsi might be a way for your Problem.
Greetz
--Andreas
Greetz
--Andreas
Re: Are there Regular Expressions in TD?
Hi!
As we don't use TD 6, I don't know what's possible in regard to .Net, where you can use System.Text.RegularExpressions.
And of course, you can always write a wrapper using C.
hth, ymmv, hand
clem
You can use VBScript RegExp (article from 1999, partly hilarious) via COM if you want to, but I don't know how fast this is.Msay wrote:Hi,
well it seems that no one has ever used Regex in TD.
As we don't use TD 6, I don't know what's possible in regard to .Net, where you can use System.Text.RegularExpressions.
And of course, you can always write a wrapper using C.
hth, ymmv, hand
clem
-
- Founder/Site Admin
- Posts: 3498
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Re: Are there Regular Expressions in TD?
You can use the Microsoft RegEx class.
An example here:
https://samples.tdcommunity.net/index ... rch_mode=f
(It is created in TD1.5, but it will show how to do it)
An example here:
https://samples.tdcommunity.net/index ... rch_mode=f
(It is created in TD1.5, but it will show how to do it)
Regards,
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Re: Are there Regular Expressions in TD?
Thanks a lot for all those suggestions!
Writing a wrapper in c doesn't sound like my expertise (haven't done it so far), so I'll skip that one.
But I'll definitely have a throughout look at the other things. (Though SQL is rarely an option.)
I haven't used any .NET so far, but this regex class seems pretty promising
And the sample Dave posted is great. I'm not very experienced at including foreign stuff, so having a complete example (thus old) is very helpful.
Thanks a lot to you two, Dave & Clem!
Oh I get so excited about being able to use regex
Cheers!
Writing a wrapper in c doesn't sound like my expertise (haven't done it so far), so I'll skip that one.
But I'll definitely have a throughout look at the other things. (Though SQL is rarely an option.)
I haven't used any .NET so far, but this regex class seems pretty promising
And the sample Dave posted is great. I'm not very experienced at including foreign stuff, so having a complete example (thus old) is very helpful.
Thanks a lot to you two, Dave & Clem!
Oh I get so excited about being able to use regex
Cheers!
Who is online
Users browsing this forum: [Ccbot] and 2 guests