Posts

Showing posts from December, 2021

Regular Expression |R

Regular Expressio '\s' : To accept the single white space. eg: To accept the space along with text need to use. ([a-z]+\s)+ var validate_pattern_azdotspace = "([a-z]+[ \\ . \\ s]?)*[a-z]+" ; if you are using this with Validate.js lib. consider of adding additional backslash with '\s' Eg: '\\s'. Use Case: Alphanumeric with space and dot. The expression must contain an alphabet. '(?=.*[a-z])([a-z0-9]+[\\.\\s]?)*[a-z0-9]+[\\s]?' Different blocks in expression (?=.*[a-z]) ([a-z0-9]+[\\.\\s]?)* [a-z0-9]+[\\s]? Block 1 Note: if regex is used in javascript, need to add an escape character  eg : "\s" for single white space, it can be represented in javascript " \\s " the text should not contain an only numbers, it can accept numbers in between