Thread View: news.software.readers
17 messages
17 total messages
Started by JimH
Sun, 13 Sep 2009 08:25
ARG!!!! \b again...
Author: JimH
Date: Sun, 13 Sep 2009 08:25
Date: Sun, 13 Sep 2009 08:25
23 lines
1787 bytes
1787 bytes
Ok, now that the previous is working I discover that only half the problem is solved. I would also like to match the word "and" along with the "&" character in the lines below: 1) this_&_that 2) me_and_you 3) here,_there_&_everywhere 4) hands_and_feet If the use of underscore as a space character was uncommon, I wouldn't concern myself with the fact that the regexp \band\b|& misses lines 2 and 4 since "_" doesn't trigger a word boundary. Unfortunately some of the more desirable posts have come from those who do this. The way I see it, the space and underscore are the only two characters that are used as whitespaces that need to be matched (although I'm not opposed to matching other whitespaces). Is there a solution any more "elegant" than: [ _](and|&)[ _] (Luckily, I don't recall ever seeing a desired Subject line beginning or ending with "and" or "&")
Re: ARG!!!! \b again...
Author: Mike Dee
Date: Sun, 13 Sep 2009 10:47
Date: Sun, 13 Sep 2009 10:47
41 lines
2576 bytes
2576 bytes
JimH wrote: > Ok, now that the previous is working I discover that only half the > problem is solved. I would also like to match the word "and" along > with the "&" character in the lines below: > >1) this_&_that > 2) me_and_you > 3) here,_there_&_everywhere > 4) hands_and_feet > > If the use of underscore as a space character was uncommon, I > wouldn't concern myself with the fact that the regexp \band\b|& > misses lines 2 and 4 since "_" doesn't trigger a word boundary. > Unfortunately some of the more desirable posts have come from > those who do this. > > The way I see it, the space and underscore are the only two > characters that are used as whitespaces that need to be matched > (although I'm not opposed to matching other whitespaces). Is there > a solution any more "elegant" than: > > [ _](and|&)[ _] > > (Luckily, I don't recall ever seeing a desired Subject line > beginning or ending with "and" or "&") Phase 2? ;-) Along with word boundaries "\b" there are non-word boundaries "\B" \B_(and|&)_\B Will match: _and_ and _&_ & -- dee
Re: ARG!!!! \b again...
Author: JimH
Date: Sun, 13 Sep 2009 11:48
Date: Sun, 13 Sep 2009 11:48
69 lines
3144 bytes
3144 bytes
Mike Dee <mikedee@emteedee.invalid> wrote in news:Xns9C85D3BE515ADemteedee@ 87.106.137.111: > JimH wrote: > >> Ok, now that the previous is working I discover that only half the >> problem is solved. I would also like to match the word "and" along >> with the "&" character in the lines below: >> >>1) this_&_that >> 2) me_and_you >> 3) here,_there_&_everywhere >> 4) hands_and_feet >> >> If the use of underscore as a space character was uncommon, I >> wouldn't concern myself with the fact that the regexp \band\b|& >> misses lines 2 and 4 since "_" doesn't trigger a word boundary. >> Unfortunately some of the more desirable posts have come from >> those who do this. >> >> The way I see it, the space and underscore are the only two >> characters that are used as whitespaces that need to be matched >> (although I'm not opposed to matching other whitespaces). Is there >> a solution any more "elegant" than: >> >> [ _](and|&)[ _] >> >> (Luckily, I don't recall ever seeing a desired Subject line >> beginning or ending with "and" or "&") > > Phase 2? ;-) > > Along with word boundaries "\b" there are non-word boundaries "\B" > > \B_(and|&)_\B > > Will match: > _and_ > and > _&_ > & > Yeah, after posting my second question I realized it might appear as if I was asking for help with my homework. It's for my own use. (Lines 3 & 7 below hint at the NG's I intend to target) It's more along the lines that I didn't fully define what I needed before trying to solve it. If I had created all 8 lines and then used them when testing a regexp, there would have been only the single post. 1) this_&_that 2) me_and_you 3) here,_there_&_everywhere 4) hands_and_feet 5) this & that 6) me and you 7) here, there & everywhere 8) hands and feet When reading the above lines, the mind can easily distinguish that the underscore is being used as a space. If I could remove the underscore from the definition of a word character, the original regexp would have worked beautifully. I don't understand why your regexp will match "and". It seems to me that it requires that two underscores appear.
Re: ARG!!!! \b again...
Author: Mike Dee
Date: Sun, 13 Sep 2009 12:48
Date: Sun, 13 Sep 2009 12:48
45 lines
2943 bytes
2943 bytes
JimH wrote: > I don't understand why your regexp will match "and". It seems to > me that it requires that two underscores appear. It won't match "and" without the _and_ being present. To explain: I make judicious use of Xnews's built-in regex tool, and perhaps you haven't come across it as yet (easy to overlook whats available to Xnews). That is, go: "Special" menu, "Test Regex" submenu. In the Regex tool dialog that appears; Type in the regex that you want to test into the top field labeled, "Pattern". Type the text string that you want to test it against in the second field labeled, "Test String". Then click the "Match" button. The result will either be "Match" or "No Match". If there is a match (meaning, the regex works), you will see the results in the lowest field labeled, "Matched string and sub-patterns". So if you were to enter into the top field labeled "Pattern": \B_(and|&)_\B then in the 2nd field labeled "Test String", type: this_and_that Clicking the "Match" button you would get a match. In the lowest field of the dialog you would see it matches the string: _and_ but it also matches the sub-pattern in the match: "and". In this case "and" is a sub-pattern match because of the parenthesis surrounding (and|&). If you were scoring on only \B_and_\B then you would get a match of only _and_, - there would be no sub-pattern "and" to match. HTH. -- dee
Re: ARG!!!! \b again...
Author: JimH
Date: Sun, 13 Sep 2009 14:18
Date: Sun, 13 Sep 2009 14:18
52 lines
2749 bytes
2749 bytes
Mike Dee <mikedee@emteedee.invalid> wrote in news:Xns9C85E83939B0Cemteedee@ 87.106.137.111: > JimH wrote: > >> I don't understand why your regexp will match "and". It seems to >> me that it requires that two underscores appear. > > It won't match "and" without the _and_ being present. To explain: > > I make judicious use of Xnews's built-in regex tool, and perhaps you > haven't come across it as yet (easy to overlook whats available to > Xnews). > > That is, go: "Special" menu, "Test Regex" submenu. > > In the Regex tool dialog that appears; Type in the regex that you > want to test into the top field labeled, "Pattern". Type the text > string that you want to test it against in the second field labeled, > "Test String". Then click the "Match" button. The result will either > be "Match" or "No Match". If there is a match (meaning, the regex > works), you will see the results in the lowest field labeled, > "Matched string and sub-patterns". > > So if you were to enter into the top field labeled "Pattern": > > \B_(and|&)_\B > > then in the 2nd field labeled "Test String", type: > > this_and_that > > Clicking the "Match" button you would get a match. In the > lowest field of the dialog you would see it matches the string: > > _and_ > > but it also matches the sub-pattern in the match: "and". > > In this case "and" is a sub-pattern match because of the parenthesis > surrounding (and|&). If you were scoring on only \B_and_\B then you > would get a match of only _and_, - there would be no sub-pattern > "and" to match. > > HTH. > I never noticed that option. Thank you for pointing it out. I can understand the existence of subpatterns (I've toyed with back references), but XNews can score on them??
Re: ARG!!!! \b again...
Author: me
Date: Mon, 14 Sep 2009 01:56
Date: Mon, 14 Sep 2009 01:56
31 lines
2166 bytes
2166 bytes
JimH <nvm@nunya.biz> wrote in
news:Xns9C8568DEE88B1hahadotdotdot@74.209.136.91:
>
> I can understand the existence of subpatterns (I've toyed
> with back references), but XNews can score on them??
>
>From Luu Tran's notes to Xnews users:
[ quot ]
...
Xnews uses Philip Hazel's PCRE package.
...
AUTHOR
Philip Hazel <ph10@cam.ac.uk>
University Computing Service,
New Museums Site,
Cambridge CB2 3QG, England.
Phone: +44 1223 334714
Copyright (c) 1998 University of Cambridge.
[ /quot ]
Look for pcre - Perl-compatible regular expressions. I forgot
where I got the description. There's a ref. to it at
http://xnews.newsguy.com/
J
--
Replies to: Nherr1professor2doktor31109(at)Oyahoo(dot)Tcom
Re: ARG!!!! \b again...
Author: Mike Dee
Date: Mon, 14 Sep 2009 02:24
Date: Mon, 14 Sep 2009 02:24
42 lines
3225 bytes
3225 bytes
JimH wrote: > Mike Dee <mikedee@emteedee.invalid> wrote: > [...] >> That is, go: "Special" menu, "Test Regex" submenu. [...] > > I never noticed that option. Thank you for pointing it out. YW. Its very useful for testing your regex quickly. There are stand-alone progs for testing regex, which have more features, but Xnews's built-in one is readily at hand. > I can understand the existence of subpatterns (I've toyed with back > references), but XNews can score on them?? If the regex contains a sub-pattern (which must be matched) Xnews has no choice but to score on them when finding a match, using that regex It can't score on the sub-pattern alone, if that's what you mean. It takes the regex given to it to find a matching string, if there is a sub-pattern in the regex it is inclusive to finding that match. Using the regex \B_(and|&)_\B again as an example: the string "this_&_that" will get a match on "_&_" because it matches both the string "_&_" and the sub-pattern "&". Xnews would not find a match if all conditions in the regex were not met. All conditions in this case, are that there must be a matching string on either an "and" or a "&" sandwiched between two "_"s. The strings "This & That" or "This and That" or "This_+_That" would not get a match using the above regex If you were to write the above regex separately as \B_and_\B and \B_&_\B there would be no sub-pattern matching involved, you would get a matched string on "_and_" and "_&_" alone, if those conditions were met. -- dee
Re: ARG!!!! \b again...
Author: »Q«
Date: Mon, 14 Sep 2009 03:46
Date: Mon, 14 Sep 2009 03:46
11 lines
1509 bytes
1509 bytes
In <news:Xns9C8568DEE88B1hahadotdotdot@74.209.136.91>, JimH <nvm@nunya.biz> wrote: > I can understand the existence of subpatterns (I've toyed with back > references), but XNews can score on them?? Yes. Xnews can score using any PCRE expressions, including ones with back-references.
Re: ARG!!!! \b again...
Author: JimH
Date: Mon, 14 Sep 2009 09:55
Date: Mon, 14 Sep 2009 09:55
52 lines
3507 bytes
3507 bytes
Mike Dee <mikedee@emteedee.invalid> wrote in news:pan.2009.09.14.02.24.35.205908@emteedee.invalid: > JimH wrote: > >> Mike Dee <mikedee@emteedee.invalid> wrote: >> > [...] >>> That is, go: "Special" menu, "Test Regex" submenu. > [...] >> >> I never noticed that option. Thank you for pointing it out. > > YW. Its very useful for testing your regex quickly. There are stand-alone > progs for testing regex, which have more features, but Xnews's built-in > one is readily at hand. > >> I can understand the existence of subpatterns (I've toyed with back >> references), but XNews can score on them?? > > If the regex contains a sub-pattern (which must be matched) Xnews has no > choice but to score on them when finding a match, using that regex > > It can't score on the sub-pattern alone, if that's what you mean. It takes > the regex given to it to find a matching string, if there is a > sub-pattern in the regex it is inclusive to finding that match. > > Using the regex \B_(and|&)_\B again as an example: > > the string "this_&_that" will get a match on "_&_" because it matches > both the string "_&_" and the sub-pattern "&". Xnews would not find a > match if all conditions in the regex were not met. All conditions in this > case, are that there must be a matching string on either an "and" or a "&" > sandwiched between two "_"s. > > The strings "This & That" or "This and That" or "This_+_That" would not > get a match using the above regex > > If you were to write the above regex separately as \B_and_\B and \B_&_\B > there would be no sub-pattern matching involved, you would get a matched > string on "_and_" and "_&_" alone, if those conditions were met. > Ah, ok I see what you're saying. I did mean score on the subpattern alone. It would be nice if there was some way it could do a "partial score" to give me some idea how well it matched. Oh well, dreams are easy and free. :) I've got a text editor (and a file renamer too - which is handy) that can use regexps, but until I verify a candidate as working in XNews, I keep it in my mental "unconfirmed" bin. This menu option will allow that bin to keep from growing too large (at my age, that's always a plus).
Re: ARG!!!! \b again...
Author: JimH
Date: Mon, 14 Sep 2009 09:57
Date: Mon, 14 Sep 2009 09:57
36 lines
2191 bytes
2191 bytes
me@tadyatam.invalid wrote in news:Xns9C85DF35F4F68metadyataminvalid@feeder.eternal-september.org: > JimH <nvm@nunya.biz> wrote in > news:Xns9C8568DEE88B1hahadotdotdot@74.209.136.91: > >> >> I can understand the existence of subpatterns (I've toyed >> with back references), but XNews can score on them?? >> > > From Luu Tran's notes to Xnews users: > [ quot ] > ... > Xnews uses Philip Hazel's PCRE package. > ... > AUTHOR > > Philip Hazel <ph10@cam.ac.uk> > University Computing Service, > New Museums Site, > Cambridge CB2 3QG, England. > Phone: +44 1223 334714 > > Copyright (c) 1998 University of Cambridge. > [ /quot ] > > Look for pcre - Perl-compatible regular expressions. I forgot > where I got the description. There's a ref. to it at > http://xnews.newsguy.com/ > > J That's interesting. I don't know how (or even if) it differs in its implementation from any other package though.
Re: ARG!!!! \b again...
Author: »Q«
Date: Mon, 14 Sep 2009 13:13
Date: Mon, 14 Sep 2009 13:13
24 lines
2242 bytes
2242 bytes
In <news:Xns9C863C1F06EA9hahadotdotdot@74.209.136.98>,
JimH <nvm@nunya.biz> wrote:
> Mike Dee <mikedee@emteedee.invalid> wrote in
> news:pan.2009.09.14.02.24.35.205908@emteedee.invalid:
>
> > JimH wrote:
> >> I can understand the existence of subpatterns (I've toyed with
> >> back references), but XNews can score on them??
> >
> > If the regex contains a sub-pattern (which must be matched) Xnews
> > has no choice but to score on them when finding a match, using that
> > regex
> >
> > It can't score on the sub-pattern alone, if that's what you mean.
> > It takes the regex given to it to find a matching string, if there
> > is a sub-pattern in the regex it is inclusive to finding that match.
> Ah, ok I see what you're saying. I did mean score on the subpattern
> alone.
A subpattern is a pattern, so if you want to score on it alone, just use
it by itself.
Re: ARG!!!! \b again...
Author: JimH
Date: Mon, 14 Sep 2009 16:22
Date: Mon, 14 Sep 2009 16:22
30 lines
2338 bytes
2338 bytes
=?UTF-8?B?wrtRwqs=?= <boxcars@gmx.net> wrote in news:20090914081351.7ff40645 @bellgrove.remarqs.net: > In <news:Xns9C863C1F06EA9hahadotdotdot@74.209.136.98>, > JimH <nvm@nunya.biz> wrote: > >> Mike Dee <mikedee@emteedee.invalid> wrote in >> news:pan.2009.09.14.02.24.35.205908@emteedee.invalid: >> >> > JimH wrote: > >> >> I can understand the existence of subpatterns (I've toyed with >> >> back references), but XNews can score on them?? >> > >> > If the regex contains a sub-pattern (which must be matched) Xnews >> > has no choice but to score on them when finding a match, using that >> > regex >> > >> > It can't score on the sub-pattern alone, if that's what you mean. >> > It takes the regex given to it to find a matching string, if there >> > is a sub-pattern in the regex it is inclusive to finding that match. > >> Ah, ok I see what you're saying. I did mean score on the subpattern >> alone. > > A subpattern is a pattern, so if you want to score on it alone, just use > it by itself. > Yeah, I could do that. I was just looking for an easy "twofer." :)
Re: ARG!!!! \b again...
Author: Mike Dee
Date: Wed, 16 Sep 2009 02:24
Date: Wed, 16 Sep 2009 02:24
38 lines
3266 bytes
3266 bytes
JimH wrote: > Mike Dee <mikedee@emteedee.invalid> wrote in > news:pan.2009.09.14.02.24.35.205908@emteedee.invalid: > >> Using the regex \B_(and|&)_\B again as an example: [...] >> If you were to write the above regex separately as \B_and_\B and \B_&_\B >> there would be no sub-pattern matching involved, you would get a matched >> string on "_and_" and "_&_" alone, if those conditions were met. > > Ah, ok I see what you're saying. I did mean score on the subpattern alone. It > would be nice if there was some way it could do a "partial score" to give me > some idea how well it matched. Oh well, dreams are easy and free. :) Yes, a sub-pattern is inclusive of the whole regex, either you will get a matching pattern or you won't. > I've got a text editor (and a file renamer too - which is handy) that > can use regexps, but until I verify a candidate as working in XNews, I > keep it in my mental "unconfirmed" bin. This menu option will allow that > bin to keep from growing too large (at my age, that's always a plus). I think you'll find Xnews's built-in regex tester a very helpful tool. With the added bonus of whatever regex you test with it, it will work in Xnews - if it gets a match in the tester. If you get "No Match" in the tester, then its not going to work, period, unless you can fix the mistake. My only beef with it, is it can't tell you why a regex doesn't work if you don't get a match - Oh well, I can't complain about the price when it comes to Xnews, eh? ;-) Cheers. -- dee
Re: ARG!!!! \b again...
Author: JimH
Date: Wed, 16 Sep 2009 07:30
Date: Wed, 16 Sep 2009 07:30
19 lines
1992 bytes
1992 bytes
Mike Dee <mikedee@emteedee.invalid> wrote in news:pan.2009.09.16.02.24.25.960607@emteedee.invalid: > I think you'll find Xnews's built-in regex tester a very helpful tool. > With the added bonus of whatever regex you test with it, it will work in > Xnews - if it gets a match in the tester. If you get "No Match" in > the tester, then its not going to work, period, unless you can fix the > mistake. > > My only beef with it, is it can't tell you why a regex doesn't work if > you don't get a match - Oh well, I can't complain about the price when > it comes to Xnews, eh? ;-) > > Cheers. > If you know of ANY (Windows) program that WILL tell you why a regex didn't work, I'm all ears. :)
Re: ARG!!!! \b again...
Author: Mike Yetto
Date: Wed, 16 Sep 2009 11:57
Date: Wed, 16 Sep 2009 11:57
12 lines
2342 bytes
2342 bytes
Bada bing JimH <nvm@nunya.biz> bada bang: > If you know of ANY (Windows) program that WILL tell you why a regex didn't > work, I'm all ears. :) > Regex Coach. I don't remember where I found it since for the past three and a half years I've used Windows at work only. Mike "that isn't by choice" Yetto -- In theory, theory and practice are the same. In practice they are not.
Re: ARG!!!! \b again...
Author: Mike Dee
Date: Wed, 16 Sep 2009 13:04
Date: Wed, 16 Sep 2009 13:04
23 lines
2491 bytes
2491 bytes
Mike Yetto wrote: > Bada bing JimH <nvm@nunya.biz> bada bang: >> If you know of ANY (Windows) program that WILL tell you why a regex didn't >> work, I'm all ears. :) >> > > Regex Coach. I don't remember where I found it since for the > past three and a half years I've used Windows at work only. > > Mike "that isn't by choice" Yetto Here, perhaps? <http://weitz.de/regex-coach/> I've "lost" erm, archived the last regex tool that I'd used and couldn't recall it's name. Making do with Xnews's has been sufficient enough for my needs. -- dee
Re: ARG!!!! \b again...
Author: JimH
Date: Wed, 16 Sep 2009 17:02
Date: Wed, 16 Sep 2009 17:02
16 lines
1962 bytes
1962 bytes
Mike Yetto <myetto1@nycap.invalid> wrote in news:slrn20090916074943.201.twooffive@may.eternal-september.org: > Bada bing JimH <nvm@nunya.biz> bada bang: >> If you know of ANY (Windows) program that WILL tell you why a regex >> didn't work, I'm all ears. :) >> > > Regex Coach. I don't remember where I found it since for the > past three and a half years I've used Windows at work only. > > Mike "that isn't by choice" Yetto Thanks you you and Mike Dee for the recommendation. I'll give it a look. From the description it would seem to do everything Xnews test does (and then some).
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads