newLISP Fan Club

Forum => newLISP newS => Topic started by: cormullion on October 18, 2006, 03:13:55 AM

Title: find-all query
Post by: cormullion on October 18, 2006, 03:13:55 AM
With find-all, how do I specify an option without specifying an expression:



(find-all str-pattern str-text [expr] [int-option])



I want to find all the valid numbers in a string, so want to specify some options such as case-insensitive...  But I don't want to process anything...
Title:
Post by: Sammo on October 18, 2006, 07:17:21 AM
How about something like



> (find-all "(is)" "newLISPisNEWLISP" $1 1)

("IS" "is" "IS")



in which [expr] = $1.
Title:
Post by: cormullion on October 18, 2006, 08:18:00 AM
Right. Although it seems like the $1 is just a filler, until you need the option...



> (find-all "is" "newLISP is cool, is it")
("is" "is")
> (find-all "is" "newLISP is cool, is it" $1 0)
("is" "is")
> (find-all "is" "newLISP is cool, is it" $1 1)
("is" "is" "is")


[/code]
Title:
Post by: Lutz on October 18, 2006, 08:18:53 AM
... or if there are no parenthesized sub-expressions:


(find-all "is" "newLISPisNEWLISP" $0 1)
=> ("IS" "is" "IS")


$0 is always the entire expression found, without any processing.



Lutz
Title:
Post by: cormullion on October 18, 2006, 10:10:37 AM
OK, thanks!