# Path: pyxform/constants.py
# ROW_FORMAT_STRING: str = "[row : %s]"
# 
# Path: pyxform/errors.py
# class PyXFormError(Exception):
#     """Common base class for pyxform exceptions."""
# 
#     pass


import re
from pyxform.constants import ROW_FORMAT_STRING
from pyxform.errors import PyXFormError



def value_or_label_format_msg(name: str, row_number: int) -> str:
    return (
        ROW_FORMAT_STRING % str(row_number)
        + f" Parameter '{name}' has a value which is not valid."
        + " Values must begin with a letter or underscore. Subsequent "
        + "characters can include letters, numbers, dashes, underscores, and periods."
    )


def value_or_label_test(value: str) -> bool:
    query = re.search(r"^[a-zA-Z_][a-zA-Z0-9\-_\.]*$", value)
    if query is None:
        return False
    else:

# Path: pyxform/constants.py
# ROW_FORMAT_STRING: str = "[row : %s]"
# 
# Path: pyxform/errors.py
# class PyXFormError(Exception):
#     """Common base class for pyxform exceptions."""
# 
#     pass


# Path: pyxform/validators/pyxform/select_from_file_params.py
import re
from pyxform.constants import ROW_FORMAT_STRING
from pyxform.errors import PyXFormError




def value_or_label_format_msg(name: str, row_number: int) -> str:
    return (
        ROW_FORMAT_STRING % str(row_number)
        + f" Parameter '{name}' has a value which is not valid."
        + " Values must begin with a letter or underscore. Subsequent "
        + "characters can include letters, numbers, dashes, underscores, and periods."
    )


def value_or_label_test(value: str) -> bool:
    query = re.search(r"^[a-zA-Z_][a-zA-Z0-9\-_\.]*$", value)
    if query is None:
        return False
    else:

        return query.group(0) == value