A regular expression is a pattern describing a certain amount of text. The most basic regular expression consists of a single literal character.
We use regular expression in Cucumber to write Step Definitions.
Step Definition in Java using Regular Expression
@When("^I fill in \"([^\"]*)\" with:$")
public void i_fill_in_with(String elementName, String messageText)
{
driver.findElement(By.id("message")).sendKeys(messageText);
}