zsh-users
 help / color / mirror / code / Atom feed
* how to search for a substring in a parameter?
@ 2003-01-13 18:13 Carlos Carvalho
  2003-01-13 18:26 ` Bart Schaefer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Carlos Carvalho @ 2003-01-13 18:13 UTC (permalink / raw)
  To: zsh-users

I'm trying to see if the value of a parameter contains a given string
but didn't find an elegant way. All pattern matching substitutions
return only the non-matched portion of the value. There's a way to do
substitutions but not testing. I must be missing something. I'm using

   if (( ${#foo//pattern/} < ${#foo} )); then
	# contains pattern
   else
	# doesn't contain pattern
   fi

Is there a better way?


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-14  5:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-13 18:13 how to search for a substring in a parameter? Carlos Carvalho
2003-01-13 18:26 ` Bart Schaefer
2003-01-13 18:26 ` Zefram
2003-01-13 18:32 ` Peter Stephenson
2003-01-13 21:48   ` Carlos Carvalho
2003-01-14  5:16     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).