[cl-ppcre-devel] Using scan

Gary King gwking at metabang.com
Mon Jul 7 13:45:11 UTC 2008


Try something like this:

(defun full-match-p (regex string)
   (multiple-value-bind (start end array-1 array-2)
       (cl-ppcre:scan regex string)
     (declare (ignore array-1 array-2))
     (and (= start 0)
	 (= end (length string)))))


On Jul 7, 2008, at 8:14 AM, Dave Pawson wrote:

> 2008/7/7 Gary King <gwking at metabang.com>:
>> Hi Dave,
>>
>> If I understand your question correctly, you want to look at
>> multiple-value-bind. This lets you bind multiple return values  
>> (hence the
>> name :->). E.g., (completely untested code)
>>
>> (mulitple-value-bind (a b c d array-1 array-2)
>> (cl-ppcre:scan ...)
>> ;; now a, b, c, d, array-1 and array-2 are bound to the values  
>> returned
>> from scan
>
> Simpler question then.
>
> How to test for a simple, full match?
>
> regex="ABC" testString="ABC"
>
> scan or scan-to-strings seems to be the correct choice?
>
> regards
>
>
> -- 
> Dave Pawson
> XSLT XSL-FO FAQ.
> http://www.dpawson.co.uk
> _______________________________________________
> cl-ppcre-devel site list
> cl-ppcre-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-ppcre-devel

--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM







More information about the Cl-ppcre-devel mailing list