

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
8 messages in org.openoffice.fr.prog[prog] Regexp...| From | Sent On | Attachments |
|---|---|---|
| Serge LE LOUARNE | Aug 16, 2004 6:54 am | |
| Laurent Godard | Aug 16, 2004 7:24 am | |
| Laurent Godard | Aug 16, 2004 7:29 am | |
| Serge LE LOUARNE | Aug 16, 2004 9:43 am | |
| Laurent Godard | Aug 16, 2004 11:33 am | |
| Serge LE LOUARNE | Aug 17, 2004 1:34 am | |
| Laurent Godard | Aug 17, 2004 2:15 am | |
| Serge LE LOUARNE | Aug 17, 2004 2:41 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [prog] Regexp... | Actions... |
|---|---|---|
| From: | Serge LE LOUARNE (serg...@neuf.fr) | |
| Date: | Aug 16, 2004 6:54:53 am | |
| List: | org.openoffice.fr.prog | |
Bonjour,
Je souhaite utiliser les regexp sur un fichier texte ouvert seulement en memoire, a l'aide du code suivant :
Sub createDico 'Ouvrir un fichier texte, et en extraire les chaines (1 par ligne) qui correspondent
Dim dlgFile as object Dim inputFile() as string Dim regExpLine as object Dim fileDebut, fileFin as integer Dim regExp as object Dim regExpTarget as Object
'Ouverture en lecture d'un unique fichier, extension par défaut *.dic dlgFile = CreateUnoService("com.sun.star.ui.dialogs.FilePicker") dlgFile.AppendFilter ("Fichier Dictionnaire","*.dic") dlgFile.setMultiSelectionMode(false) dlgFile.execute() inputFile = dlgFile.Files fileDebut = freefile Open inputFile(0) for input as #fileDebut
'Ouverture/creation du fichier d'arrivée fileFin = freeFile Open "pendu.dic" for output as #fileFin
'préparation de l'expression régulière regExp = #fileDebut.createSearchDescriptor regExp.searchString = "^[A-Za-z]{1,12}" regExp.searchRegularExpression = true regExpTarget = #fileDebut.findAll(regExp) msgbox regExpTarget.count
End Sub
J'ai un message d'erreur sur la ligne "regExp = #fileDebut.createSearchDescriptor" : Variable non paramétrée. Si je le remplace #fileDebut par thisComponent, ca marche. Quelqu'un saurait-il utiliser la recherche de regexp avec un fichier non affiché ?
Par ailleurs, je constate un comportement étonnant de la ligne "Open "pendu.dic" for output as #fileFin". Il y a systématiquement création du fichier pendu.dic, mais également d'un repertoire "File://" dans mon home.
Merci, Serge







