Extracts the value of a specified field from a BibTeX entry string using regular expressions.
The function is case-insensitive and handles various spacing patterns around the field
delimiter.
Usage
extract_field(entry, field)
Arguments
- entry
Character string containing a BibTeX entry
- field
Name of the field to extract (e.g., "title", "author", "year")
Value
Character string containing the field value if found, NA if the field is not present
Details
The function searches for patterns of the form "field = {value}" in the BibTeX entry,
ignoring case and allowing for variable whitespace around the equals sign. The value
is expected to be enclosed in curly braces.