[perl/regexp] Teken mag niet voorkomen

Pagina: 1
Acties:
  • 38 views sinds 30-01-2008

  • muba
  • Registratie: April 2002
  • Laatst online: 19-10-2013

muba

Prince of Persia!

Topicstarter
Dit is ongetwijfeld een vette RTFM of een UTFS maar ik kan het echt niet vinden.
Stel, je wilt de string %20 vervangen door een spatie:
code:
1
s/%20/ /gi


Maar NIET als er een \ voor de % staat. De enige methode die ik kan bedenken is:
code:
1
s/\\{0}%20/ /gi


Dit kan volgens mij nooit de eleganste oplossing zijn, en vandaar dat ik me afvraag of er een betere/nettere manier is...?

Reporter: Mister Gandhi, what do you think of western civilisation?
Gandhi: I think it would be a good idea


  • muba
  • Registratie: April 2002
  • Laatst online: 19-10-2013

muba

Prince of Persia!

Topicstarter
Wat? Is dit *echt* zo'n RTFM dan?

Reporter: Mister Gandhi, what do you think of western civilisation?
Gandhi: I think it would be a good idea


Verwijderd

*lamaar*

  • muba
  • Registratie: April 2002
  • Laatst online: 19-10-2013

muba

Prince of Persia!

Topicstarter
Nja sorry hoor, dat noem ik bullshitten... In de topic title staat toch heel mooi [perl/regexp]

Ok dit ook laatmaar dan :D

[ Voor 0% gewijzigd door muba op 19-10-2002 19:05 . Reden: Ignore this ]

Reporter: Mister Gandhi, what do you think of western civilisation?
Gandhi: I think it would be a good idea


Verwijderd

MUBA schreef op 19 oktober 2002 @ 19:04:
Nja sorry hoor, dat noem ik bullshitten... In de topic title staat toch heel mooi [perl/regexp]
Ik zag het al... ik was je voor :P

  • muba
  • Registratie: April 2002
  • Laatst online: 19-10-2013

muba

Prince of Persia!

Topicstarter
Gezellig he, zo langs elkaar heen werken... maar goed, je wee het antwoord dus niet? :D

BTW heb d'r even lekker een strike doorheen gezet :)

Reporter: Mister Gandhi, what do you think of western civilisation?
Gandhi: I think it would be a good idea


  • MisterData
  • Registratie: September 2001
  • Laatst online: 26-08 21:52
Zoek op www.phpfreakz.nl es naar de Regex-tutorial :) Die is heel duidelijk en behandeld dit vast wel :)

  • Annie
  • Registratie: Juni 1999
  • Laatst online: 25-11-2021

Annie

amateur megalomaan

negative lookback assertion is dacht ik de term (maar ben een regexp n00b dus kan er compleet naast zitten :D)
code:
1
s/(?<!\\)%20/ /g

Today's subliminal thought is:


  • Floor-is
  • Registratie: Maart 2000
  • Laatst online: 08:41

Floor-is

5.2

Dit is wel een typische searchvraag hoor, sorry.

Bericht hierboven

Pagina: 1

Dit topic is gesloten.