Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Programming languages > RE Despair - help required
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 11th October 17:44
yoav
External User
 
Posts: 1
Default RE Despair - help required



I am trying the following:

re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files")

and I get a return of NoneType, and I have no idea why. I know that I
missing something here, but I really can't figure out why (I bet it's
something obvious). I also tried this RE on KODOS and it works fine
there, so I am really puzzled.

Any ideas?


Thanks.
  Reply With Quote


  sponsored links


2 11th October 17:45
sybren stuvel
External User
 
Posts: 1
Default RE Despair - help required



Yoav enlightened us with:


Because you don't match a carriage return "\r".


Use forward slashes instead of backward slashes. And go nag at
Microsoft for using the most widely used escape character as a path
separator...

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
  Reply With Quote
3 11th October 17:45
robert kern
External User
 
Posts: 1
Default RE Despair - help required


Look at the second string. It has "\r" in the middle of it where you
really want "\\r" (or alternatively r"c:\ret_files").

--
Robert Kern
rkern@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
  Reply With Quote
4 19th October 01:21
yoav
External User
 
Posts: 1
Default RE Despair - help required


Thanks guys. Issue solved.
I am also going to give Microsoft a call about it. Any other issues you
want me to raise while I am talking to them?


Cheers.
  Reply With Quote
5 19th October 01:28
sion arrowsmith
External User
 
Posts: 1
Default RE Despair - help required


Did you actually look at the docs Fredrik pointed you at? Did you,
in particular, notice os.path.basename, which does (almost) exactly
what you want?

--
\S -- siona@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
  Reply With Quote
6 19th October 01:28
yoav
External User
 
Posts: 1
Default RE Despair - help required


Thank you all guys. It seems like the simpler the solution, the more I
am happy about it. Sorry, for the simple question, I am quite new to
this lang.

Cheers.
  Reply With Quote
7 7th December 03:54
sybren stuvel
External User
 
Posts: 1
Default RE Despair - help required


Yoav enlightened us with:


Because you don't match a carriage return "\r".


Use forward slashes instead of backward slashes. And go nag at
Microsoft for using the most widely used escape character as a path
separator...

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
  Reply With Quote
8 7th December 03:56
robert kern
External User
 
Posts: 1
Default RE Despair - help required


Look at the second string. It has "\r" in the middle of it where you
really want "\\r" (or alternatively r"c:\ret_files").

--
Robert Kern
rkern@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
  Reply With Quote
9 15th December 06:50
yoav
External User
 
Posts: 1
Default RE Despair - help required


Thanks guys. Issue solved.
I am also going to give Microsoft a call about it. Any other issues you
want me to raise while I am talking to them?


Cheers.
  Reply With Quote
10 15th December 06:57
yoav
External User
 
Posts: 1
Default RE Despair - help required


Don't think it will do much good. I need to get them from a file and
extract the last folder in the path. For example:
if I get "c:\dos\util"
I want to extract the string "\util"
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666