Reply to topic  [ 4 posts ] 
getting partial find expressions into variables 
Author Message

Joined: 2007-04-12 14:59:36
Posts: 229
With a selection containing an e-mail address, is it possible to get what is before and what is after the at sign into two variables?
Or to ask differently: If I do a find for that selection like
Code:
Find '(.+)@(.+)', 'Es'
is it possible to get \1 and \2 into macro-variables with which to continue the macro?

Thanks for any help


2007-07-17 00:48:54
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
Unfortunately there is no simple way to do this (as there is in Perl), but if you break into Perl you have several options. Probably the easiest is to simply have Perl repeat the regular expression:

Code:
$expression = '(\S+)@(\S+)'
Find $expression, "E"
$found = Read Selection
$found1 = ''
$found2 = ''
Begin Perl
   $found =~ /$expression/;
   $found1 = $1;
   $found2 = $2;
End
Prompt "Found user '$found1' at domain '$found2'"


2007-07-17 01:36:35
Profile WWW
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
Oh, and I'll definitely file this as a feature request!


2007-07-17 01:39:04
Profile WWW

Joined: 2003-07-22 01:31:29
Posts: 32
Post 
Yes. And in addition to the value, a pointer to the selection would be great. Or to expand on that idea further, the ability to return found objects as a list of selection offsets (or object references, as I would think of them) would open up great possibilities.


2007-07-18 00:12:52
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software