07-21-2009
Python Regex
I have the below string and regex. However I cant understand why it works the way it does. IP has been changed for safety
String = NowSMS Error Report. Error initializing SMSC Interface 'SMPP - 10.15.8.10:17600'. Interface is not available.
Regex = (.+\.)\s(.+)
I get two backreferences as expected.
Group 1: NowSMS Error Report. Error initializing SMSC Interface 'SMPP - 10.15.8.10:17600'.
Group 2: Interface is not available.
Question:
Why doesn't group 1 = NowSMS Error Report. <------ stopping at first period
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly:
if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies
2. Shell Programming and Scripting
I starting teaching myself python and am stuck on trying to understand why I am not getting the output that I want. Long story short, I am using PDB for debugging and here my function in which I am having my issue:
import re
...
...
...
def find_all_flvs(url):
soup =... (1 Reply)
Discussion started by: metallica1973
1 Replies
3. Programming
As a newbie to Python, I am trying to write a script in which is will add all the log files (*.log) from within a directory to a list, open the files and search for an ip using a regex and single it out (appending the ip's to the list). So far, I have:
import re, os
def list_files()
content = ... (4 Replies)
Discussion started by: metallica1973
4 Replies
4. Shell Programming and Scripting
Well, I'm a python noob and my last post here I was introduced to Regex. I thought this would be easy since I knew Regex with Bash. However, I've been banging my head a while to extract an ip address from ifconfig with this:
#!/usr/bin/python
import re
import subprocess
from subprocess... (5 Replies)
Discussion started by: Azrael
5 Replies
5. Shell Programming and Scripting
I am working on requirement on spreadsheet in python scripting.
I have a spreadsheet containing cell values and with background color.
I am able to read the value value but unable to get the background color of that particular cell.
Actually my requirement is to read the cell value along... (1 Reply)
Discussion started by: giridhar276
1 Replies
6. Programming
Here is a snippet of my code:
blahblahblah...
blah
for link in goodies.soup.find_all('a'):
blah.append(link.get('href'))
blah=list(set(blah))
which gives my list of urls. So now I use a regex to search for the relevant urls which I want in a list:
for r... (0 Replies)
Discussion started by: metallica1973
0 Replies
7. Shell Programming and Scripting
I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works:
LOCAL_CONFIG
#
Kcheckaddress regex -a@MATCH
+<@+?\.++?\.(us|info|to|br|bid|cn|ru)
LOCAL_RULESETS
SLocal_check_mail
# check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies
8. Shell Programming and Scripting
Hello
I have a big excel file for Ticket Data Analysis. The idea is to make meaningful insight from Resolution Field. Now as people write whatever they feel like while resolving the ticket it makes quite a task.
1. They may or may not tag it with something like below within the resolution... (1 Reply)
Discussion started by: radioactive9
1 Replies
9. Programming
Hi all...
As you know I like making code backwards compatible for as many platforms as possible.
This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies
LEARN ABOUT HPUX
xterrorhandler
XtErrorHandler() XtErrorHandler()
Name
XtErrorHandler - interface definition for low-level error and warning handler procedures.
Synopsis
typedef void (*XtErrorHandler)(String);
String message;
Inputs
message Specifies the error message.
Description
An XtErrorHandler is registered as an error or warning handler with XtAppSetErrorHandler() or XtAppSetWarningHandler(). It is invoked by
XtAppError() or XtAppError(). The error handler should display the specified string in some appropriate fashion. Some applications may
wish to log errors to a file as well. Error handlers should exit; warning handlers should return.
See XtErrorMsgHandler(2) for a description of the high-level error and warning handler procedure.
Example
The Intrinsics default error and warning handlers are shown below. The XTERROR_PREFIX and XTWARNING_PREFIX symbols are by default the
empty string in the MIT implementation, but may be configured when the Intrinsics are compiled.
void _XtDefaultError(message)
String message;
{
extern void exit();
(void)fprintf(stderr, "%sError: %s0, XTERROR_PREFIX, message);
exit(1);
}
void _XtDefaultWarning(message)
String message;
{
if (message && *message)
(void)fprintf(stderr, "%sWarning: %s0, XTWARNING_PREFIX, message);
return;
}
See Also
XtAppError(1), XtAppSetErrorHandler(1), XtAppSetWarningHandler(1), XtAppWarning(1),
XtErrorMsgHandler(1).
Xt - Error Handling XtErrorHandler()