Re: [Dorset] Slight OT: Regular Expressions in Winblows

2011-02-21 Thread Ralph Corderoy

Hi Terry,

 Simple I thought; the expression I want is '_[0-9]{4}'.  However, the
 only thing I could get to work, using Notepad++ and MS Visual Studio
 Find tools, was '_[0-9][0-9][0-9][0-9]'.  Here at home I can get my
 original expression t o work in Kate, but not in Notepad++ running
 under wine.  So! I thought; this i s a Windows thing.  But I can't get
 it to work in nano either, although '[0-9] {4}' finds any 4 digits,
 but '_[0-9]{4}' won't find four digits with a preceding underscore.
 
 What's the obvious thing I'm missing?

History.  Regular expressions were introduced to text processing by Ken
Thompson who we recently mentioned.  The syntax has evolved a bit by
then and there are variations today.  Your regexp could be written as

_[0-9][0-9][0-9][0-9]
_[0-9]\{4\}
_[0-9]{4}

and possibly others once you introduced non-Unix into the mix.  And in
those, the character class [0-9] could be replaced by \d, for digit, in
some variations.

The first of the six is the oldest;  a Basic Regular Expression as POSIX
calls it.  That would work in most places.  How do you know which to use
where?  Depends on the program being used.

Cheers,
Ralph.


--
Next meeting:  Blandford Forum, Wednesday 2011-03-02 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Slight OT: Regular Expressions in Winblows

2011-02-21 Thread Terry Coles
On Monday 21 Feb 2011, Ralph Corderoy wrote:
 No.  Could it be that /[0-9]{4}/ worked because you were telling nano
 you were searching for a regexp with M-R, but when you tried /_[0-9]{4}/
 you forgot to do that?  The prompt for the search string says whether
 it's expecting a regexp or not.

Actually, this is weirder than I thought. Originally, I proved the regexp in 
Kate andf then copied it from the Kate Find field to the nano Find field.  No 
matter what I did, I couldn't get a match.

Just now, I put in the regexp that always worked \[0-9]{4}\ into nano and then 
copied the underscore char from the nano edit window and pasted it into the 
Find field.  It worked!  Then I deleted the underscore char and typed it 
instead.  It worked!  I then copied and pasted the regexp from Kate agian.  
You guessed it.  It worked!

I can't understand it, but I guess I'll never find out what I was doing wrong 
now.

 Having tried here, I find /_[0-9]{4}/ works fine in nano, only finding
 what I expected.  (The // are merely quotes for regexps, not to be
 entered.)

It does for me now ;-)

-- 
Terry Coles
64 bit computing with Kubuntu Linux


--
Next meeting:  Blandford Forum, Wednesday 2011-03-02 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Slight OT: Regular Expressions in Winblows

2011-02-21 Thread jr
On 21 February 2011 21:38, Keith Edmunds k...@midnighthax.com wrote:
 On Mon, 21 Feb 2011 21:21:14 +, l...@discoverlinux.co.uk said:

 In vi

 :1,$s/_[0-9][0-9][0-9][0-9]/found/g

 In case it isn't clear, Vim is available on Windows as well. I know Vim
 isn't everyone's cup of tea (for some inexplicable reason), but good to
 know that there is a powerful editor available for those unfortunate
 enough to need to edit files on a Windows platform.

also, you can save a couple more keystrokes if you want to operate on
all lines in the buffer:

:%s/find/replace/g

-- 
regards, jr.

time flies like an arrow, fruit flies like a banana.

--
Next meeting:  Blandford Forum, Wednesday 2011-03-02 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Slight OT: Regular Expressions in Winblows

2011-02-21 Thread Andrew Reid Paterson
On Monday, February 21, 2011 09:38:24 pm Keith Edmunds wrote:
 On Mon, 21 Feb 2011 21:21:14 +, l...@discoverlinux.co.uk said:
  In vi
  
  :1,$s/_[0-9][0-9][0-9][0-9]/found/g
 
 In case it isn't clear, Vim is available on Windows as well. I know Vim
 isn't everyone's cup of tea (for some inexplicable reason), but good to
 know that there is a powerful editor available for those unfortunate
 enough to need to edit files on a Windows platform.
 
 --
 Next meeting:  Blandford Forum, Wednesday 2011-03-02 20:00
 Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
 How to Report Bugs Effectively:  http://goo.gl/4Xue
And of course winviis available on windows too.
Andy

--
Next meeting:  Blandford Forum, Wednesday 2011-03-02 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Belkin wireless USB

2011-02-21 Thread Peter Merchant
On Mon, 2011-02-21 at 17:42 +, Tim Allen wrote:
 Hi Peter
 
 On 19/02/11 18:09, Peter Merchant wrote:
  My ZYxel wireless USB stick has been working at 16% signal strength, and
  my neighbour suggested that I try a Belkin one as he had a good signal
  (albeit on W7).
 
  I borrowed a Belkin F5D7050 which is quite an old one and I get a
  marvelous 42% strength. It dropped right in without any reconfiguration.
  Before buying an old one I wondered if I bought a new one supporting
  802.11n as well as 'b', whether it would work under Linux.
 
  Does anyone have any experience of 802.11n devices in Linux?
 
 
 I am using a Draytek 802.11n USB stick, which uses a Realtek RT2870 
 radio. Drivers are available on the Realtel Wiki. They required a few 
 minor hacks (2009) - if your Belkin uses the same radio I can stick my 
 notes on the Wiki.
 
 Cheers
 
 Tim
 
Dmesg gives: 
   20.974186] Registered led device: rt2500usb-phy0::radio
[   20.974279] Registered led device: rt2500usb-phy0::quality
[   20.974867] usbcore: registered new interface driver rt2500usb
[   22.084960] usbcore: registered new interface driver rt73usb
[   23.136495] EXT4-fs (sda7): mounted filesystem with ordered data
mode. Opts: errors=remount-ro
[   24.327680] usbcore: registered new interface driver p54usb
[   24.349318] udev[356]: renamed network interface wlan0 to wlan3

and it works as is, obviously, so no extra drivers needed. 
'wlan0' was the Zyxel one.
As it is a borrowed Belkin, I hope in 28 minutes to have purchased one
for myself. 

Thanks for all the help and advice,

Peter


--
Next meeting:  Blandford Forum, Wednesday 2011-03-02 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://goo.gl/4Xue