[java] expression régulière

Fermé
karine - 27 avril 2005 à 15:37
 befa - 8 juin 2005 à 11:36
Bonjour,

Je vous explique mon problème.
J'ai une chaine String qui contient ça :
HTTP/1.1 200 OK
Date: Wed, 27 Apr 2005 13:26:04 GMT
Server: Apache/1.3.27 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b PHP/4.1.2 mod_perl/1.26
Last-Modified: Fri, 15 Jun 2001 14:29:07 GMT
ETag: "11536-3b8-3b2a1bb3"
Accept-Ranges: bytes
Content-Length: 952
Connection: close
Content-Type: text/html

<HTML>
<HEAD>
<title>DESS IA Paris VI</title>
<script language="JavaScript" type="text/javascript">
if (self != top) { top.location.href = self.location.href; }
</script>
</HEAD>
<frameset cols="180,*" border=1 framespacing=0 frameborder=1>
 <frame src="map2.php3" name="bords" scrolling=auto noresize
         framespacing=0 frameborder=0 border=0
         marginheight=0  marginwidth=5>

  <frame src="main.html" name="main" scrolling=auto
         framespacing=0 frameborder=0 border=0
         marginheight=0  marginwidth=0>

 <noframe>
         <center> <h4> On dirait que votre navigateur ne lit pas les frames. <p>
                  Désolé mais vous devez avoir un browser qui peut
                  lire les frames pour pouvoir profiter de ce site!
         </center>
  </noframe>
</frameset>
<noscript>
Make sure that JavaScript is turned on.
Otherwise, this page (and rest of the pages in this site) won't work.
</noscript>
</html>



Moi je voudrais pouvoir séparer HTTP/1.1 200 OK du reste et récuperer les deux parties.

Pour l'instant je fais ça :
String regex3 = "HTTP(.*)\\s{1}([.]+)";

Mais le prog ne trouve pas de match.

Est-ce qu'il y aurait un spécialiste des regex dans le coin ?

Merci
A voir également:

2 réponses

C'est bon j'ai trouvé une solution !

J'ai fait un split à la place, ça marche très bien.

Mais merci quand meme ;-)
0
salut,

tant que tu est reussi a résoudre ton probleme :-)
pour info les expression reguliere en java ne se gere pas a partir d'uneString (comme en perl ou php), mais avec les classes du package
java.util.regex 
(notamment les classes
Pattern
et
matcher
)

a plus.
0