08-27-2006
loop throw perl regexp selection
hello all
i have string that i need to parse something list that :
<form name="CustomerStatus" action="<% env.GetURI %>" method="post"<$if(blah)%> name="<% env.get("StatusList") %>" ><% hello %><input type="hidden" name="<% env.get("Operation") %>" value="">
now im selecting the the string part with lazy regexp selection :
some thing like that :
(<%.*?%>)
but now im stack if say i like to loop throw all the matching string parts and do something with that selection and then put the modified selection back to place ?
how can i ?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need help with a Perl regular expression.
The following string blows up my program: <david(greg jim)>
If I type this string, there is no problem: <david(greg_jim)> or type
david(gregjim) or type <david greg jim> the CGI program does not complain.
For some reason that I do not understand the... (1 Reply)
Discussion started by: mh53j_fe
1 Replies
2. Shell Programming and Scripting
What is the easiest way to get full address of *.jpg images from html file using perl?
example:
http://farm3.static.flickr.com/2397/2126443111_65a810004c.jpg (1 Reply)
Discussion started by: mirusnet
1 Replies
3. Shell Programming and Scripting
Hi,
I need to develop a GUI for Perl scripts which needs frequent user interactions(like getting the inputs from the user at various stages). Can anyone suggest a language to develop a GUI which is simple to use and which can be implemented within a short time frame?
Thanks,
Vishwa (1 Reply)
Discussion started by: vishwa787
1 Replies
4. Shell Programming and Scripting
Hello,
I cannot see what's wrong in my code.
When I run code below, it just print an empty string.
my $test = "SWER~~ERTGSDFGTHAS_RTAWGA_DFAS.x4-234253454.in";
if ($test = ~ m/\~{1,2}.*4/) {
print "$1\n";
}
else {
print "No match...\n";
}
Anyone know what I'm doing wrong?
... (4 Replies)
Discussion started by: urandom
4 Replies
5. Shell Programming and Scripting
Hi. Here's a tricky one (at least to me):
I have a file named theFile.txt (UTF-8) that contains the following:
a
b
cWhen I execute
perl -pe 's|a.*c|d|sg' theFile.txtin bash 3.2 on MAC OS X 10.6, I get no match, i.e. the result is
a
b
cagain. Any clues why? (2 Replies)
Discussion started by: BatManWSL
2 Replies
6. Shell Programming and Scripting
hello,
I want to replace awk with a perl one liner in unix.
i use in awk REGEX and FS ( field separator) because
awk syntaxes in different unix os versions have not the same behaviour.
Awk, Nawk and GNU Awk Cheat Sheet - good coders code, great reuse
i have a file named "file" and want... (5 Replies)
Discussion started by: bora99
5 Replies
7. Programming
Hi gurus, i am trying to write simple perl script using win32 ole which will iterate over all M$ word paragraphs (any text that ends with a hard return) and print only those paragraphs that matches the specified condition. The problem is that I need to access font size property. It seems to me that... (0 Replies)
Discussion started by: wakatana
0 Replies
8. Shell Programming and Scripting
Hi,
I have file like below:
1|1212|34353|5fdf 6575||dfgdg sfsdf |afsf||4|aasfbc|~1213~~~~~
1|1212|34353|5fdf 6575||dfgdg sfsdf |affsf| |4|abc|~rwarw~~asa~~~123~312313
1|1212|34353|5fdf 6575||dfgdg sfsdf |afasfs||4|aasfdbc|~564564~~~~
1|1212|34353|5fdf 6575||dfgdg sfsdf... (1 Reply)
Discussion started by: sol_nov
1 Replies
9. Shell Programming and Scripting
Hi,
I am trying with the below Perl one-liner using regular expression to extract the first and second column of a text file:
perl -p -e "s/\s*(\w+).*/$1/"
perl -p -e "s/\s*.+\s(.+)\s*/$1\n/"
whereas the text file's data looks like:
Error: terminated 2233
Warning: reboot 3434
Warning:... (3 Replies)
Discussion started by: royalibrahim
3 Replies
10. Shell Programming and Scripting
Trying to find and replace one string with another string in a file
#!/usr/bin/perl
$csd_table_path = "/file.ntab";
$find_str = '--bundle_type=021';
$repl_str = '--bundle_type=021 --target=/dev/disk1s2';
if( system("/usr/bin/perl -p -i -e 's/$find_str/$repl_str/' $csd_table_path")... (2 Replies)
Discussion started by: cillmor
2 Replies
LEARN ABOUT OSX
tk_getselection
Tk_GetSelection(3) Tk Library Procedures Tk_GetSelection(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tk_GetSelection - retrieve the contents of a selection
SYNOPSIS
#include <tk.h>
int
Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter to use for reporting errors.
Tk_Window tkwin (in) Window on whose behalf to retrieve the selection (determines display from which to retrieve).
Atom selection (in) The name of the selection to be retrieved.
Atom target (in) Form in which to retrieve selection.
Tk_GetSelProc *proc (in) Procedure to invoke to process pieces of the selection as they are retrieved.
ClientData clientData (in) Arbitrary one-word value to pass to proc.
_________________________________________________________________
DESCRIPTION
Tk_GetSelection retrieves the selection specified by the atom selection in the format specified by target. The selection may actually be
retrieved in several pieces; as each piece is retrieved, proc is called to process the piece. Proc should have arguments and result that
match the type Tk_GetSelProc:
typedef int Tk_GetSelProc(
ClientData clientData,
Tcl_Interp *interp,
char *portion);
The clientData and interp parameters to proc will be copies of the corresponding arguments to Tk_GetSelection. Portion will be a pointer
to a string containing part or all of the selection. For large selections, proc will be called several times with successive portions of
the selection. The X Inter-Client Communication Conventions Manual allows a selection to be returned in formats other than strings, e.g.
as an array of atoms or integers. If this happens, Tk converts the selection back into a string before calling proc. If a selection is
returned as an array of atoms, Tk converts it to a string containing the atom names separated by white space. For any other format besides
string, Tk converts a selection to a string containing hexadecimal values separated by white space.
Tk_GetSelection returns to its caller when the selection has been completely retrieved and processed by proc, or when a fatal error has
occurred (e.g. the selection owner did not respond promptly). Tk_GetSelection normally returns TCL_OK; if an error occurs, it returns
TCL_ERROR and leaves an error message in interp->result. Proc should also return either TCL_OK or TCL_ERROR. If proc encounters an error
in dealing with the selection, it should leave an error message in interp->result and return TCL_ERROR; this will abort the selection
retrieval.
KEYWORDS
format, get, selection retrieval
Tk 4.0 Tk_GetSelection(3)