NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums General General Discussion v
« Previous 1 … 68 69 70 71 72 … 159 Next »
Regex help needed please

 
  • 0 Vote(s) - 0 Average
Regex help needed please
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#1
2008-04-25, 09:44 PM
Hi I have a string that I'm trying to extract a value from. The html I'm stripping from is the following:
Code:
You have used <strong> 13.02 GB</strong>

And here is the regex I've got that does work....
Code:
(You have used <strong> )(?'extract'[0-9]+.[0-9]+[ ]?[GB|MB]+)(</strong>)

The value shows up as group 2. The problem with this is I want the regex in a config file, and at the moment, when i load the config file, it complains about the '<' inside the string.

What I'd like to do is look for "You have used" ignore the '<strong>' and extract the value.

Any regex wizards out there know how to do it??
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#2
2008-04-25, 09:51 PM
Oh, I think I finally got it.
Code:
(You have used )*(?'extract'[0-9]+.[0-9]+[ ]?[GB|MB]+)
JonnyCam
Offline

Posting Freak

Posts: 1,153
Threads: 87
Joined: Feb 2006
#3
2008-04-29, 10:27 PM
Are you using this for your telstra download cap? If so, I'd be interested in how you do this, so I can add it to my VFD.

Cheers
"Shut up brain, or I'll stab you with a Q-Tip!"

--= Win7, C2D 2.93 GHz, ASUS 9400GT Silent, 2GB Ram, Few HDD's, 3TB unRAID server, Samsung 50" 1080p Plasma via HDMI, 40" 1080i LCD via VGA =-- * PVR2000 Analog PCI / Avermedia DVB-S PCI / Hauppauge 2200 DVB/Analog * PCH GBPVR Client * *BD-E6500 w/ NPVR client*
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#4
2008-04-29, 11:13 PM
yeah I have a program i run on a machine with a website to get the usage. It dumps xml files down for month and a general one with your current usage..

There's also that other program, mentioned on geekzone that downloads the usage as well. http://tuc.swaziboy.com/
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#5
2008-04-30, 07:11 AM
Slightly off topic but Expresso (free) a good tool for designing/testing regular expressions. Came in handy for the Cinema Listings scraping.
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#6
2008-04-30, 07:40 AM
Cool, will have a look at that....
stefan
Offline

Posting Freak

Posts: 3,116
Threads: 81
Joined: Oct 2004
#7
2008-04-30, 10:03 AM
McBainUK Wrote:Slightly off topic but Expresso (free) a good tool for designing/testing regular expressions. Came in handy for the Cinema Listings scraping.

Good tip. I use The Regex Coach, which works great, too. I'll have to look at Expresso.
I'm not always right
GB-PVR 1.2.9
Accent HT-400 Case, AMD Athlon 64 3800+ 1024MB, 1TB+300GB+180GB, WinXP Pro-SP2, NVidia 7600GT
Nova-T USB2, PVR-350 recording from Dilog 355 DVB-T box, USB-UIRT (receiving & transmitting)
Ted the Penguin
Offline

Posting Freak

Posts: 1,590
Threads: 64
Joined: Aug 2006
#8
2008-04-30, 10:04 PM
McBainUK Wrote:Slightly off topic but Expresso (free) a good tool for designing/testing regular expressions. Came in handy for the Cinema Listings scraping.

glad to see that you started using regex to do your scraping... did it make it easier for you?
sub Wrote:Are you trying to make sure I get nothing done today?
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#9
2008-04-30, 10:09 PM
Ted the Penguin Wrote:glad to see that you started using regex to do your scraping... did it make it easier for you?

I think the biggest advantage to using regex isn't to make it easier, but you can externalise a regex string whereas the old method of:
int startpos = string.indexof("characters");
string bitIwant = string.substring(startpos);

Was hard coded into the program.... So with regex you can store the string in a config file, and for an update to find something new, if can be don't without a recompile...
JonnyCam
Offline

Posting Freak

Posts: 1,153
Threads: 87
Joined: Feb 2006
#10
2008-05-02, 03:46 AM
Quote: yeah I have a program i run on a machine with a website to get the usage. It dumps xml files down for month and a general one with your current usage..

There's also that other program, mentioned on geekzone that downloads the usage as well. http://tuc.swaziboy.com/

Thanks for that. Does this export the data at all, so I can use it for a VFD display, or should I use regex?

Thanks
"Shut up brain, or I'll stab you with a Q-Tip!"

--= Win7, C2D 2.93 GHz, ASUS 9400GT Silent, 2GB Ram, Few HDD's, 3TB unRAID server, Samsung 50" 1080p Plasma via HDMI, 40" 1080i LCD via VGA =-- * PVR2000 Analog PCI / Avermedia DVB-S PCI / Hauppauge 2200 DVB/Analog * PCH GBPVR Client * *BD-E6500 w/ NPVR client*
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Media Companion regex p37307 1 2,292 2016-10-01, 04:48 PM
Last Post: gEd
  Tips needed for DVD ripping bgowland 9 4,528 2015-12-11, 03:43 AM
Last Post: fuffy
  Minimal media centre setup suggestions needed. bgowland 21 8,427 2014-10-10, 11:32 AM
Last Post: mvallevand
  24/7 recording - questions and help needed :) oyci3c 10 4,320 2012-07-06, 10:39 PM
Last Post: steeb
  <solved> Help needed - batchfile ShiningDragon 6 2,797 2012-01-23, 07:06 PM
Last Post: ShiningDragon
  Thinking of switching to GBPVR - Advice Needed gavo 6 2,795 2010-03-19, 09:36 AM
Last Post: martint123
  Freesat channel numbers needed bgowland 2 2,306 2008-12-07, 09:05 PM
Last Post: bgowland
  CBBC (Crystal Palace) tuning info needed bgowland 13 4,461 2007-09-29, 08:20 PM
Last Post: djmuk
  Stuck - ideas needed Knobby 22 6,779 2007-06-08, 08:33 PM
Last Post: Ted the Penguin
  o/t: what kinda electrical adapter needed to charge canon sd600 batteries in europe? tunanugget 12 4,400 2007-03-28, 09:14 AM
Last Post: HtV

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode