[prev in list] [next in list] [prev in thread] [next in thread]
List: ast-users
Subject: Re: [ast-users] Word boundaries \< and \> supported in ksh ~(E)?
From: dan.rickhoff () comcast ! net
Date: 2010-11-01 16:43:26
Message-ID: 1666857747.205301.1288629806581.JavaMail.root () sz0164a ! emeryville ! ca ! mail ! comcast ! net
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Olga,
It's not the regular expression you're hoping for, but using ksh's own regular \
expressions, I find that for beginning of word I can use:
@(|*\W)
and for end of word:
@(\W*|)
For example:
$ x='Some string with myWord appearing somewhere in the sting as a "word".'
$ [[ "$x" == @(|*\W)myWord@(\W*|) ]] && print yes || print no
yes
Regards,
Dan ----- Original Message -----
From: "ольга крыжановская" <olga.kryzhanovska@gmail.com>
To: "ast-users" <ast-users@research.att.com>
Sent: Sunday, October 31, 2010 10:19:42 AM
Subject: [ast-users] Word boundaries \< and \> supported in ksh ~(E)?
Does ksh ~(E) support word boundaries \< and \>? I have tried lengthy
to get it working but I only receive failures.
As example I tried this expression to match three words with the \<
and \> word boundaries but instead \1 captures the whole string:
x="hello 12 world" ; y="${x/~(Elr)\<(.+)\>\<(.+)\>\<(.+)\>/\1}" ;
printf "%s\n" "$y"
hello 12 world
I need an example which works, and if ~(P) supports word boundaries I
need an example here, too.
Olga
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ olga.kryzhanovska@gmail.com \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
_______________________________________________
ast-users mailing list
ast-users@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-users
[Attachment #5 (text/html)]
<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div \
style='font-family: Arial; font-size: 12pt; color: #000000'><font \
class="Apple-style-span" face="Arial" size="4"><span class="Apple-style-span" \
style="font-size: 12pt; ">Olga,</span></font><div style="color: rgb(0, 0, 0); \
font-family: Arial; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); \
font-family: Arial; font-size: 12pt; ">It's not the regular expression you're hoping \
for, but using ksh's own regular expressions, I find that for beginning of word I can \
use:</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 12pt; \
"><br></div><div><font class="Apple-style-span" \
face="Arial">@(|*\W)</font></div><div><font class="Apple-style-span" \
face="Arial"><br></font></div><div><font class="Apple-style-span" face="Arial">and \
for end of word:</font></div><div><font class="Apple-style-span" \
face="Arial"><br></font></div><div><font class="Apple-style-span" \
face="Arial">@(\W*|)</font></div><div><font class="Apple-style-span" \
face="Arial"><br></font></div><div><font class="Apple-style-span" \
face="Arial"><br></font></div><div><font class="Apple-style-span" face="Arial">For \
example:</font></div><div><font class="Apple-style-span" \
face="Arial"><br></font></div><div><font class="Apple-style-span" face="Arial">$ \
x='Some string with myWord appearing somewhere in the sting as a \
"word".'</font></div><div><font class="Apple-style-span" face="Arial"><div>$ [[ "$x" \
== @(|*\W)myWord@(\W*|) ]] && print yes || print no \
</div><div>yes</div><div><br></div></font></div><div><font \
class="Apple-style-span" face="Arial">Regards,</font></div><div><font \
class="Apple-style-span" face="Arial">Dan</font></div>----- Original Message \
-----<br>From: "ольга крыжановская" \
<olga.kryzhanovska@gmail.com><br>To: "ast-users" \
<ast-users@research.att.com><br>Sent: Sunday, October 31, 2010 10:19:42 \
AM<br>Subject: [ast-users] Word boundaries \< and \> supported in ksh \
~(E)?<br><br>Does ksh ~(E) support word boundaries \< and \>? I have tried \
lengthy<br>to get it working but I only receive failures.<br><br>As example I tried \
this expression to match three words with the \<<br>and \> word boundaries but \
instead \1 captures the whole string:<br>x="hello 12 world" ; \
y="${x/~(Elr)\<(.+)\>\<(.+)\>\<(.+)\>/\1}" ;<br>printf "%s\n" \
"$y"<br>hello 12 world<br><br>I need an example which works, and if ~(P) supports \
word boundaries I<br>need an example here, too.<br><br>Olga<br>-- <br> \
, _ \
_ \
,<br> { \/`o;====- Olga Kryzhanovska \
-====;o`\/ }<br>.----'-/`-/ olga.kryzhanovska@gmail.com \
\-`\-'----.<br> `'-..-| / http://twitter.com/fleyta \
\ |-..-'`<br> /\/\ Solaris/BSD//C/C++ \
programmer /\/\<br> `--` \
\
`--`<br>_______________________________________________<br>ast-users \
mailing list<br>ast-users@research.att.com<br>https://mailman.research.att.com/mailman/listinfo/ast-users<br></div></body></html>
_______________________________________________
ast-users mailing list
ast-users@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic