I am trying to extract conversations from a Postfix log file based on the client that initiated them. This is the awk script that extracts the matching message IDs:
awk '/client.host.name/ && !(/timeout/||/disconnect/) { sub(":","",$6);print $6}' maillog
This is using a standard Postfix maillog as input (see below for sample data). Wha...
I am using the following regular expression to validate e-mails, but it allows empty strings as well, how can I change it to prevent it:
^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$
I am using an asp:RegularExpressionValidator. My other option is to add on a asp:RequiredFieldValidator, but I am curious if th...
Hello !
Is it possible in JavaScript to do something like preg_match does in PHP ?
I would like to be able to get two numbers from string:
var text = 'price[5][68]';
into two separated variables:
var productId = 5;
var shopId = 68;
Edit:
I also use MooTools if it would help.
...
I am encountering a strange javascript regex problem on Firefox 3.6 and Chrome 6 dev. I am working on a massive form entry website that has some basic javascript validation using jQuery.
$(document).ready(function() {
$("tr[id^='" + BaseRowId + "rid']").each(function(){obj.WireRowEvents(this);});
}
var obj = {
"WireRowEvents": funct...
Hey guys, I thought this would be fairly straightforward, but it's not it seems..maybe I'm just writing the syntax wrong..
In my model I'm checking for certain key words
before_validation :deal_validation
def deal_validation
if self.description.match /(exp\s|expire|ex\s|print|mention|\/)/
errors.add(:description, "Now just a se...
I am trying to take file names that look like:
MAX_1.01.01.03.pdf look like Max_1010103.pdf.
Currently I have this code:
public void Sanitizer(List<string> paths)
{
string regPattern = (@"[~#&!%+{}]+");
string replacement = " ";
Regex regExPattern = new Regex(regPattern);
Regex regExPattern2 = new Regex(@"\s{2,}");
Rege...
I want to extract a substring from my expression using regex.h library in C. Here is the code
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
regex_t preg;
char *string = "Random_ddName:cateof:Name_Random";
char *pattern = ".*Name:\\(.*\\):Name.*";
int rc;
size_t ...
How do I determine the file extension of a file name string?
lets say I have
I'm.a.file.name.tXt
the regex should return tXt
...
I can include this file directly now without tr1 in VS 2010 but can't find description of this file anywhere on MSDN. Where is a reference to regex header on MSDN?
...
I have
file_ext = attach.document_file_name.capture(/\.[^.]*$/)
but i guess there is no method capture.
I'm trying to get the file extension from a string. I don't yet have the file.
...
I need to know if a given string is a valid DateTime format string because the string may represent other things. I tried DateTime.ParseExact(somedate.ToString(format), format) thinking it would barf on an invalid format, but it doesn't.
So I'm good with simply testing if the string contains only "yYmMdDsShH" characters. Something like ...
I am trying to get the word after Sysdba. out of a string. Here is a example where my result would be PRODUCTION
CAST(CASE WHEN SYSDBA.PRODUCTION.SHIPPING_COMPLETE_DATE IS NOT NULL THEN 1 ELSE 0 END AS bit) AS [Shiping Completed]]
I created the regex expression
Regex CatagoryRegex = new Regex(@"SYSDBA\.(.#)\.", RegexOptions.IgnoreCa...
I want to escape all quotes that comes only after the text H1:
For instance, :
H1: "text here"
should become:
H1: "text here"
This would be easy with lookbehind, but that's not in JS.
something I tried:
.replace(/H1:(.*)(")(.*)/ig, "H1:$1"$2")
Also it should work on other similar text like:
H1: ""text here""
H1...
Hi everybody,
I'm trying to write a "suggestion search box" and I cannot find a solution that allows to highlight a substring with javascript keeping the original case.
For example if I search for "ca" I search server side in a case insensitive mode and I have the following results:
Calculator
calendar
ESCAPE
I would like to view t...
I'm using the following regex to strip out non-printing control characters from user input before inserting the values into the database.
preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $value)
Is there a problem with using this on utf-8 strings? It seems to remove all non-ascii characters entirely.
...
Dear Perl gurus:
Question abstract:
how to parse text file into two "hashes" in Perl. One store key-value pairs taken from the (X=Y) part, another from the (X:Y) part?
1=9
2=2
3=1
4=6
2:1
3:1
4:1
1:2
1:3
1:4
3:4
3:2
they are kept in one file, and only the symbol between the two digits denotes the difference.
==...
I have the following PHP code that checks if an email is valid:
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2}[mtgvu]?$", $email))
return true;
Works great but I found out today that if I try validate a .info email, it says it's invalid. Any ideas what I need to add/modify to make it return .info e...
Hi all,
This snippet
<xsd:element name="HomePhone" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="^+[0-9]{1,2}-[0-9]{1,2}-[0-9]{3}[0-9]{0,1}-[0-9]{3}[0-9]{0,1}$"></xsd:pattern>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
is returning th...
That is, given a Javascript file, this regular expression can show only the "immediate execution" of code, removing all the function definitions in the form of
function foo() {
...
}
Or can regular expression find the "matching { }" because there can many nested { }
...
Suppose I want to turn this :
http://en.wikipedia.org/wiki/Anarchy
into this :
en.wikipedia.org
or even better, this :
wikipedia.org
Is this even possible in regex?
...