ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / External file functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Reads a line in an external file, gets sections of this line according to a regular expression and assigns them to a variable.
This function is mainly used to easily analyze the log files.
Example
// Ouverture d'un fichier externe
IDFichier is int
IDFichier = fOpen("C:\MesRépertoires\AccesData.log", foRead)
IF IDFichier <> -1 THEN
       // Lecture d'une ligne dans ce fichier
	// Format : 20001221  - Achat
	sDate is string
	sInfo is string
	fReadLineRegularExpression(IDFichier, "([0-8]*) - ([A-Za-z]*)", sDate, sInfo)
	...
END
// Ouverture d'un fichier externe
MonFichierTxt is DiskFile
MonFichierTxt = fOpen("C:\MesRépertoires\AccesData.log", foRead)
IF NOT ErrorOccurred THEN
       // Lecture d'une ligne dans ce fichier
	// Format : 20001221  - Achat
	sDate is string
	sInfo is string
	fReadLineRegularExpression(MonFichierTxt, "([0-8]*) - ([A-Za-z]*)", sDate, sInfo)
	...
END
Syntax
<Result> = fReadLineRegularExpression(<File used> , <Format> , <Variable 1> [, <Variable 2> [... [, <Variable N>]]])
<Result>: Boolean
  • True if the data was read and retrieved.
  • False otherwise.
<File used>: Integer or DiskFile variable
<Format>: Character string
Reference format, expressed as a regular expression. This format uses the following characters:
A B C - / _Letters and symbols to check
[A-Z] or [0-9]Interval of letters, digits or symbols to check
*0 or more symbols to check
+1 or more symbols to check
( )Delimit part of the format to extract
{ }Defines the minimum and maximum number of times that the previous expression can occur (e.g., {min, max})
<Variable 1>: Character string, Integer, etc.
Variables that will be automatically initialized with the different parts of the format to extract. Each part is defined by the '(' and ')' characters.
<Variable 2>: Character string, Integer, etc.
Variables that will be automatically initialized with the different parts of the format to extract. Each part is defined by the '(' and ')' characters.
<Variable N>: Character string, Integer, etc.
Variables that will be automatically initialized with the different parts of the format to extract. Each part is defined by the '(' and ')' characters.
Business / UI classification: Business Logic
Component: wd300std.dll
Minimum version required
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help