| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-1.1 required=5.0 tests=BAYES_05 |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <4B0C5B65.7080401@cs.umass.edu> |
| Date: | Tue, 24 Nov 2009 17:17:09 -0500 |
| From: | Eliot Moss <moss AT cs DOT umass DOT edu> |
| User-Agent: | Thunderbird 2.0.0.23 (Windows/20090812) |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Cygwin bash regexp matching doesn't treat "\b" properly |
| References: | <26500158 DOT post AT talk DOT nabble DOT com> <26500814 DOT post AT talk DOT nabble DOT com> <4B0C4C2A DOT 3080502 AT gmail DOT com> <26503748 DOT post AT talk DOT nabble DOT com> <408995400911241354p27f2c5eek94973673d24fa3b3 AT mail DOT gmail DOT com> <26504147 DOT post AT talk DOT nabble DOT com> |
| In-Reply-To: | <26504147.post@talk.nabble.com> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
What I have often done in a case like this is:
Add the separator (space in this case) at each end of the list.
So, if the initial string is "101 203 455" I turn that into
" 101 203 455 ".
LIST=" ${LIST} "
Then I match the desired string, also surrounded by spaces,
like this:
[ -z "${LIST##* ${DESIRED} *}" ] && { ... }
This uses simple bash globbing stuff that seems to work
everywhere. It's an idiom I've become accustomed to :-) ...
Regards -- Eliot Moss
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |