I'm attempting to parse an Oracle trace file using regular expressions. My language of choice is C#, but I chose to use Ruby for this exercise to get some familiarity with it.
The log file is somewhat predictable. Most lines (99.8%, to be specific) match the following pattern:
# [Timestamp] [Thread] [Event] [Message...
hello,
is there a way to understand the following logic contained in the splitting pattern:
preg_split("/[\s,]+/", "hypertext language, programming");
in the grand scheme of things i understand what it is doing, but i really want a granular understand of how to use the escapes and special character notation. is there a granular exp...
Need to match the first part of a sentence, up to a given word. However, that word is optional, in which case I want to match the whole sentence. For example:
I have a sentence with a clause I don't want.
I have a sentence and I like it.
In the first case, I want "I have a sentence". In the second case, I want "I have a sen...
Hi There
I am hoping that someone maybe able to help me. I need to create a regex that will remove all duplicates from a input file - I am creating a ftp.exe script to upload files and do not want duplicates in the execute command.
Here is a short example of the script: There might be up to 20 or more of the same duplicates in the file...
I am trying to come up with a GNU extended regular expression that detects repeated substrings in a string of ascii-encoded bits. I have an expression that works -- sort of. The problem is that it executes really slowly when given a string that could have many solutions
The expression
([01]+)(\1)+
compiles quickly, but takes about...
I have tried to rewrite my url so that it removes php extention and adds trailing slash.
I can access the page this way now..
lovelakedistrict.com/lake-district-cottages/
but i can also access it via this way:
lovelakedistrict.com/lake-district-cottages.php
how can I remove the php extention for good. this my htaccess
Options +Follo...
Here is my text:
<span class="c1">Testing "this string"</span>
and I want to end up with this:
<span>Testing "this string"</span>
so I tried to use this regex in Notepad++ to replace with nothing:
class=".*"
but that matches this:
class="c1">Testing "this string"
How do I stop that match after one instance of "?
...
Guys i have a small and frankly stupid problem, so here it is...
I have a text that could possibly include words,numbers etc. All i want is to match the numbers inside brackets, but withtout matching them like this:
Lorem 43 ipsum dolor 1 sit amet (355) some
other text.
All i want to match is the number 355, but since there are ...
I have text like this from poker software (I have highlighted the parts I need to replace).
--- FLOP --- [Jh 9h Ah]
driverseati checks
darrington has 15 seconds left to act
darrington bets 100
InvisibleEnigma calls 100
driverseati folds
--- TURN --- [Jh 9h Ah] [3c]
darrington bets 200
InvisibleEnigma calls 200
--- R...
if(strlen($_REQUEST['email']) >= 0 && preg_match('^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$', $_REQUEST['email']))
{
$error = true;
echo "Please enter a valid Email address";
}
Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /var/www/team2648/OPIS/register.php on line 30
...
Similar to this topic.
I am trying to validate a username with the following restrictions:
Must start with a letter or number
Must be 3 to 15 characters in length
Symbols include: . - _ ( ) [ ]
Symbols cannot appear consecutively, but letters and numbers can
Edit:
Letters and numbers are a-z A-Z 0-9
Been stumped for a while. I'...
If all queries end with ; I can explode by this char, but what should I do when a ; appears in a field?
e.g.
[...]Select * From my_data where idk=';';\nSelect [...]
or
[...]Select * From my_data where idk=';\n';Select [...]
My file consists of all kinds of queries, including INSERTs and can have syntax variations like the ones s...
I am upgrading my app from rails 2 to 3 and when i 'require' this file that has an email address validator i get an 'invalid multibyte escape' error with:
dtext = '[^\\x80]'
pattern = /\A#{dtext}\z/
Any thoughts?
...
In other languages regexp you can use //g for a global match.
However, in Ruby:
"hello hello".match /(hello)/
Only captures one hello
How do I capture all hello?
...
I'm trying to match parts of a larger block of content and want to only match things at the start of the string or that are preceded by a space and I only want to match things that end at the end of string or are followed by a space. Unfortunately, my regex-fu is a bit too weak to figure this out on my own. Help me Stack Overflow, you ar...
Hello all,
I need to define a pattern so that the input string can only contain 0-9, a-z, and A-Z. Also, the length is in the range of 1-30.
Here is the script:
$fileBaseName = 'abc12345';
if (!preg_match("/^[a-zA-Z0-9]{1, 30}$/", $fileBaseName)) {
echo '<br/>' . 'invalid' . '<br/>';
} else {
echo '<br/>' . 'valid' . '<br/>';...
I have an ajax file that is called when someone begins to type in search bar. I have recently been cleaning up my urls and removing file extentions adding trailing slashes, since then my ajax file doesnt appear to load anymore. can anyone help? here my htaccess so far
Options +FollowSymlinks
Options +Indexes
RewriteEngine on
RewriteCo...
Is there a way to parse the argument values passed to a JavaScript function in python?
I want to be able to automatically document JavaScript function calls in order to make sure they have the right arguments passed to them.
For example, in:
function mymethod(fruit, vegetable, drink) {
// dummy function
}
function drink(drink) ...
I'm trying to get the size of the top level directories under the current directory (on Solaris). So I'm piping du to grep and want to match only those lines that have a single forward slash ie. the top level directories.
Something like:
du -h | grep -e <your answer here>
but nothing I try works. Help appreciated!
...
hello,
I have a large database that contains many urls, there are many domains repeating and i;m trying to get only the domain.
eg:
http://example.com/someurl.html
http://example.com/someurl_on_the_same_domain.html
http://example.net/myurl.php
http://example.org/anotherurl.php
and i want to get only domains, eg:
http://example.com
ht...