Write regular expressions in Java for the following: Strings between10and20characters (inclusive) which have odd lengths. The allowed
Fantastic news! We've Found the answer you've been seeking!
Question:
Write regular expressions in Java for the following:
- Strings between10and20characters (inclusive) which have odd lengths.
- The allowed characters here arenotspecified, and should be considered unrestricted
- Examples:automobiles,i<3pancakes13
- Non-Examples:5five,i<3pancakes14!
- A list of comma-separated, characters surrounded by square brackets[]. Recall, a character is denoted by single quotes surrounding it. An optional single space character is allowed after the comma.
- The number of characters in the list isnotspecified, so an empty list ([])isallowed.
- The term comma-separated implies that a trailing comma (['a', 'b', 'c',])is notallowed.
- The single space character does not need to be consistent, so mixed spaces (['a','b', 'c'])isallowed
- Examples:['a'],['a','b','c']
- Non-Examples:'a','b','c',['a' 'b' 'c']
- A decimal number (two integer values, where both integers are present, separated by a decimal point). The left most digit on the lefthand side of decimal point must be non-zero (i.e., there are no leading zeros) unless the only digit to the left of the decimal point is a zero. Trailing zeros are allowed. An optional sign-is allowed, prefixing the decimal as negative.
- Examples:10100.001,-1.0
- Non-Examples:1,.5
- A double-quoted string literal. Escape characters are supported starting with a backslash (\), followed by one ofbnrt'"\.
- Remember to escape things in Java! The input"1\t2"is the string literal"\"1\\t2\"". You need to be understand this well as it will occur frequently throughout this course.
- Examples:"","Hello, World!","1\t2"
- Non-Examples:"unterminated,"invalid\escape"
Related Book For
Accounting Information Systems The Processes and Controls
ISBN: 978-1118162309
2nd edition
Authors: Leslie Turner, Andrea Weickgenannt
Posted Date: