what is the regular expression for the language above {0,1} that does not contain the subword 000?  Thank you for your help!!
122959
I need to identify the set of all possible strings over $\sum$ {a, b} that do not contain the substring aaa.      I have becoming more familiar with regular-language and languages explored in Automata Theory, and have been defining a particular language through regular-expressions.           I am having a hard time trying to find the set of substrings {a, b} = $\sum^*$ (where {a, b} = $\sum$) where the strings found in $\sum^*$ do not contain the substring aaa.       Any advice on how to generate the regular-expression that will define this language would be helpful.
34578
#!/bin/bash INT=-5  if [[ "$INT" =~ ^-?[0-9]+$ ]]; then  echo "INT is an integer."  else  echo "INT is not an integer." &gt;&amp;2  exit 1  fi   What does the leading ~ do in the starting regular expression?
92765
I am having a really tough time proving the following language is not regular using the pumping lemma. This whole time I have been working on pumping lemma problems, the variable of the power has been the same on all alphabet characters that make up the string for the language.  $$L = \{0^i1^j | j \ne i\} $$  This is what I tried:  Let $p$ be the pumping length of $L$. Consider $S= 0^p1^j$, $|s| &gt; p$, and $|s| &gt; j$. Thus $s$ must satisfy the pumping lemma. Consider splitting the string:  I am assuming in order to prove this language is not regular via contradiction, we would have to find a case where the $j$ IS equal to $i$, even though they aren't supposed to be.  I am not sure how to proceed from this point of the proof and would appreciate any suggestions.  Many thanks in advance!
13063
Is it possible to write a regular expression that matches a nested pattern that occurs an unknown number of times? For example, can a regular expression match an opening and closing brace when there are an unknown number of open/close braces nested within the outer braces?  For example:  public MyMethod() {   if (test)   {     // More { }   }    // More { } } // End   Should match:  {   if (test)   {     // More { }   }    // More { } }
82144
Here is the question:     Let $A$ be any regular set over some alphabet $\Sigma$. Is the language   $$ L = \{x \;\mid\; \exists y : |y| = |x|^2, xy \in A\} $$   necessarily regular?   I am unable to approach this question to prove whether it is regular or not. In fact, this seems like a difficult question. Unlike with other regular language problems, it does not seem intuitively clear whether or not the statement is true.
29420
I'm having trouble understanding the wording of one of my homework questions. Since this question appears early in the chapter, I have a feeling that I'm misinterpreting it.  Give a finite automaton that that accepts the following language: The language over $\{a, b\}$ of any even number of $a$'s and any odd number of $b$'s.   I'm having trouble with the usage of "and". Is it asking for an FA that accepts any string that is either an even number of $a$'s or an odd number of $b$'s, e.g. $aa$, $bbb$, $aaaa$, etc, but not accept strings like $aabbb$, $abbab$.   Or, is it asking for an FA that accepts any string that contains an even number of $a$'s or an odd number of $b$'s, e.g. $aabbb$, $ababb$, etc.   The first case is relatively simple, but I've been struggling with the second. I haven't even managed to convince myself that it is a regular language (because I haven't been able to come up with a regular expression that matches it).   My questions: Which interpretation seems most likely. Is the second case a regular language, if so, give a regular expression that recognizes it.
40270
I need to calculate no of possible substrings containing "00" as a substring. I know the length of the binary string.  Eg: for a string of length 4, possible substrings are: 0000 0001 0010 0011 0100 1000 1001 1100  I just need the number of possible combinations, not enumerate all of them.
33306
Hey! I was looking at this code at   I noticed that in some situations they used hex numbers, like in line 134:  for (j = 1; val &amp;&amp; j &lt;= 0x80; j &lt;&lt;= 1, q++)   Now why would they use the 0x80? I am not that good with hex but I found an online hex to decimal and it gave me 128 for 0x80.  Also before line 134, on line 114 they have this:  small_n = (n &amp; 0xffff0000) == 0;   The hex to decimal gave me 4294901760 for that hex number. So here in this line they are making a bit AND and comparing the result to 0??  Why not just use the number? Can anyone please explain and please do give examples of other situations.  Also I have seen large lines of code where it's just hex numbers and never really understood why :(
15365
In Perl, what is a good way to perform a replacement on a string using a regular expression and store the value in a different variable, without changing the original?  I usually just copy the string to a new variable then bind it to the s/// regex that does the replacement on the new string, but I was wondering if there is a better way to do this?  $newstring = $oldstring; $newstring =~ s/foo/bar/g;
10243
I'm quite confused about the following regular expressions I found in a shell script:  ${0##*/} ${0%/*}   How do they work?
107897
I've been battling the following two questions for more than a day today.  Write a regular expression (comprised of {a, b}) that contain at least two b and do not contain abb. Write a regular expression (comprised of {a, b}) that contain abba and do not contain baa.  For the first part I wrote a basic one to start off with that doesn't handle the must two-b: b* OR a* OR (a+ AND b)* OR a*  I ran a few &quot;truth tables&quot; inputs over it and it seems ok. But the moment I add the requirement, things go haywire. Mostly because when pushing in those &quot;b&quot;s, you can suddenly use the OR to break things up. Same thing on the second one.... Any help would be greatly appreciated! Norah
20352
Is it possible to detect a valid regular expression with another regular expression?  If so please give example code below.
33382
Can a regular expression match whitespace or the start of a string?  I'm trying to replace currency the abbreviation GBP with a £ symbol. I could just match anything starting GBP, but I'd like to be a bit more conservative, and look for certain delimiters around it.  &gt;&gt;&gt; import re &gt;&gt;&gt; text = u'GBP 5 Off when you spend GBP75.00'  &gt;&gt;&gt; re.sub(ur'GBP([\W\d])', ur'£\g&lt;1&gt;', text) # matches GBP with any prefix u'\xa3 5 Off when you spend \xa375.00'  &gt;&gt;&gt; re.sub(ur'^GBP([\W\d])', ur'£\g&lt;1&gt;', text) # matches at start only u'\xa3 5 Off when you spend GBP75.00'  &gt;&gt;&gt; re.sub(ur'(\W)GBP([\W\d])', ur'\g&lt;1&gt;£\g&lt;2&gt;', text) # matches whitespace prefix only u'GBP 5 Off when you spend \xa375.00'   Can I do both of the latter examples at the same time?
6659
Given: a = 1 b = 10 c = 100  How do I display a leading zero for all numbers with less than two digits? This is the output I'm expecting: 01 10 100
74771
if A={1,2,...,600} includes all natural numbers between 1 to 600. I want to find number of elements of A that not divisible by 3 or 5 or 7?  any hint or idea?
90707
I have the following line: $0 \leqslant b \leqslant 1$  I want to display 0 &lt;= b &lt;= 1, but I get Undefined control sequence  thanks
50293
I've been using  for some time:  SUBSTRING(str_col, PATINDEX('%[^0]%', str_col), LEN(str_col))   However recently, I've found a problem with columns with all "0" characters like '00000000' because it never finds a non-"0" character to match.  An alternative technique I've seen is to use TRIM:  REPLACE(LTRIM(REPLACE(str_col, '0', ' ')), ' ', '0')   This has a problem if there are embedded spaces, because they will be turned into "0"s when the spaces are turned back into "0"s.  I'm trying to avoid a scalar UDF.  I've found a lot of performance problems with UDFs in SQL Server 2005.