Questions tagged [regular-expressions]

Regular expressions or Regex is a search pattern for strings defined by a sequence of characters.

A regular expression (shortened as regex or regexp) is a sequence of characters that specifies a search pattern. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique developed in theoretical computer science and formal language theory. The phrase regular expressions, or regexes, is often used to mean the specific, standard textual syntax for representing patterns for matching text, as distinct from the mathematical notation described below. Each character in a regular expression (that is, each character in the string describing its pattern) is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

673 questions
1
vote
1 answer

Regular expression simplification

I'm taking a computer science class and right now we need to make a regular expression for a string input consisting of the letters a, b and c with a maximum of 1 b and maximum of 4 c's. The only operators we can use are: ab = a and b a|b = a or…
Apickle
  • 13
  • 2
1
vote
1 answer

Kleene closure solves any equation

I need to solve a question but I'm quite sure I don't understand it correctly. Here's the question with its answers: In each of the following cases, find a regular expression R that satisfies the equation. (a) $L(R) = L(R^∗ )$ $R = ε$ (b) $L(R) =…
842Mono
  • 375
1
vote
1 answer

Negate regular expression

Suppose I have a simple regular expression describing a language like $(a+b)^* a?b (a+b)^*$ (a language in $\Sigma = \{a,b\}$ consisting of all words with substring $a?b$). I haven't found a general way to negate any regular expression, and it seems…
aplavin
  • 591
1
vote
1 answer

Simple regular expression for all strings over $\{0,1\}^*$ not ending in $01$

Give a regular expression for the language of all strings over $\{0,1\}^*$ not ending in $01$. $\in | 0 | 1 | (0|1)^* | (11|00|10)$ The solution above was provided by my professor but I'm not convinced that it is correct. Would the $(0|1)^*$ be any…
user3590350
  • 23
  • 1
  • 3
  • 5
1
vote
1 answer

Regular expression of alternating smaller and bigger digits

How would i go about making a regular expression that alternates between smaller and bigger numbers for an alphabet {0,1,2,3} such as "01032312" or "230102132"
1
vote
1 answer

Transformation of a regular expression

Let $a,b,c$ be regular expressions. Prove by transformation that $$(a^*b^*+c)^* \equiv (a+ (b+c)^*)^*$$ I tried to start with the second term $$(a + ((b+c)^*))^* = (a^*(b+c)^*)^* = (a^*(b^*c^*)^*)^*$$ but am stuck here. Can you please help me…
muffel
  • 2,879
0
votes
1 answer

Regular expression construction.

I would like to construct a regular expression of length at least 5 that starts with 'f' and ends with 'y' and who's second symbol is 'u' from the alphabet {a,b,...,z}. My solution to this problem is: $$$$ Let m be a string s.t.…
Vector_13
  • 626
0
votes
2 answers

A regular expression for all strings over $\{a,b\}$ which do not have both substrings $bba$ and $abb$

I am looking at the answer in a solution manual to the following question. Let the alphabet $= \{a,b\}$. Write regular expressions for: all the words that don't have both substrings $bba$ and $abb$. The answer given was…
manual
  • 61
  • 8
0
votes
1 answer

Regular Expression Reading

I'm trying to figure out what this regular expression reads as. The regular expression is the following: (0(1 + 2) * 00*) (+ = union) (* = zero or many). I believe this reads as: 0 concatenated with zero or many 1s or 2s concatenated with one or…
0
votes
1 answer

find a regular expression for a given language

It is given that $\Sigma=\{1,2,4,5,7,9\}$ and $L=\{w: w \in \Sigma^{*} \text{ ,w gets divided completely by }5\}$. Could you help me to find a regular expression for this language?
evinda
  • 7,823
0
votes
1 answer

Set of Binary Strings Corresponding To a Regular Expression

$(1 + 01)^*(0 + 01)^*$ I'm thinking {set of all binary strings} $-$ {set of binary strings that begin with 00 and contain 11} Would this be correct?
EggHead
  • 667
0
votes
1 answer

Regular expression of: $\{ w \in \Sigma^* : w \text{ does not contain the substring 110} \}$.

Given $\Sigma = \{ 0,1,2 \}$, write a regular expression for $$\{ w \in \Sigma^* : w \text{ does not contain the substring 110} \}\;.$$ I know how to do a regular expression for a language that does not contain a substring of two consequent…
TheNotMe
  • 4,841
0
votes
1 answer

$L = L\bigl((b \cup ab \cup aab)^*(\lambda \cup a \cup aa)\bigr)$ . how does $bbbbbbabaabaa$ belong to L?

Let $L$ be the language generated by the regular expression $(b \cup ab \cup aab)^*(\lambda \cup a \cup aa)$. how does bbbbbbabaabaa belong to L? I know $(b \cup ab \cup aab)^*$ can be translated to $bbbbbb$ and $(\lambda \cup a \cup aa)$ can be…
0
votes
1 answer

L = (aa)*(bb)* checking if a string belongs to L* but not to L

L = (aa)*(bb)* checking if a string belongs to L* but not to L the string is: aabbaa I can't grasp the concept of putting a * (kleene star) on L, which already has a kleene star in it's definition. What's the difference between L and L* microwise?…
0
votes
1 answer

Converting regular expression to NFA.

I have the following two regular expressions and I need to convert them to NFA diagrams. I already did some and was wondering if they made any sense...i hope I'm not confusing the signs. e+ a(a + b)* + (a + b)*aa(a + b)* [ba+(a+bb)a*b]*