file_find_expr

Synopsis

file_find_expr(file, offset, regular_expression)

Description

The file_find_expr object searches for a pattern that matches a user-specified UNIX regular expression string. This capability only works on UNIX systems. It returns the offset in bytes of the next byte after the expression.

Parameters

File

Object of type FILE.file that identifies the file that will be accessed. Note that this is not a string holding the filename.

offset

int. Specifies, in bytes, an offset from the beginning of the file.

Example

In the ASCII file, data , find the integer "ndim" that follows an expression:

ndim <any number of spaces> = <any number of spaces>

file data_file {
name = "data";
};


int offset => file_find_expr(data_file, 0, "ndim[ ]*=[ ]*");
int ndim => file_scalar_ascii(data_file, offset, 3);

Additional Examples

v/dv_examp/file_ucd.v
v/dv_examp/file_unif.v

File

v/file.v

See also related modules

File Objects Overview
file_array_ascii
file_find_expr
file_obj
file_obj bin
file_scalar_ascii
file_skip_lines
file_skip_words