![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Ubuntu 9.10 is out!!!
When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu. The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely. |
|
Programming Talk This forum is for all programming questions. The questions do not have to be directly related to Ubuntu and any programming language is allowed. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Has an Ubuntu Drip
![]() Join Date: Feb 2008
Beans: 772
Ubuntu 9.10 Karmic Koala
|
[SOLVED] anyone familiar with boost regex?
im trying to learn it , now I have a string , which has a LOT of jpg's mentioned in it...
I wonder why this code , returns only one , it should match all of them (isnt it?): http://rafb.net/p/IOGJO849.html |
|
|
|
|
|
#2 | |
|
Ubuntu addict and loving it
![]() Join Date: Jun 2007
Location: Maryland, US
Beans: 3,562
Ubuntu 9.10 Karmic Koala
|
Re: anyone familiar with boost regex?
Quote:
Now... what is it that you are trying to do? What does you data file contain? Just strings with the .jpg extension? If you are bent on using Boost, will this example not help you? http://www.boost.org/doc/libs/1_35_0...or_example.cpp P.S. I would prefer if you post your code directly onto the Ubuntu Forums, without referring to another site. |
|
|
|
|
|
|
#3 | |
|
Has an Ubuntu Drip
![]() Join Date: Feb 2008
Beans: 772
Ubuntu 9.10 Karmic Koala
|
Re: anyone familiar with boost regex?
mmm ok , what im trying to do , to be more precise , is , I have something like this , a file with many links , could be https , http , etc , all of them are jpg links only , now I would like to keep all these links in a vector or set , the file looks something like this (i manually wrote that one , the other can have anything in it , but it also has links , like this one has) :
Quote:
|
|
|
|
|
|
|
#4 |
|
Dark Roasted Ubuntu
![]() Join Date: Oct 2007
Beans: 1,026
Ubuntu 8.10 Intrepid Ibex
|
Re: anyone familiar with boost regex?
RegExes seem to be overkill here. Just split your input strings on the characters '>' and '<' and apply a check for each of the strings you get. See here, section 7.3 for such a tokenizing example.
|
|
|
|
|
|
#5 | |
|
Ubuntu addict and loving it
![]() Join Date: Jun 2007
Location: Maryland, US
Beans: 3,562
Ubuntu 9.10 Karmic Koala
|
Re: anyone familiar with boost regex?
Quote:
Now that the data file has been presented, I agree that it would be rather easy to yank a sub-string from each line within the file. If the OP is still interested in a RegEx solution using Boost, here's something I threw together this morning: PHP Code:
P.S. To compile: Code:
g++ regex.cpp -lboost_regex -o regex Last edited by dwhitney67; September 26th, 2008 at 08:56 PM.. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|