Sponsored Content
Full Discussion: Question on regexp in TCL
Top Forums Shell Programming and Scripting Question on regexp in TCL Post 302748695 by ampak on Wednesday 26th of December 2012 05:26:42 PM
Old 12-26-2012
Question on regexp in TCL

I need some help with regexp in tcl. The following code does work if the $urlvar ends in jpg,jpeg,png or gif. Eg, protocol(http/https)://testsite.com/images/image1.jpg

Code:
if { ![regexp -nocase {(jpg|jpeg|png|gif)$} $urlvar]  }  {
        //Do something
}

My problem is that if the URL does not end in these extensions this regexp is of no use. For eg, how to make this work for a URL with query strings or anything else afer the extension
Eg:
Code:
protocol(http/https)://testsite.com/images/image1.jpg?height=100&width=80

Help will be appreciated.

Last edited by Scott; 12-26-2012 at 06:34 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

few TCL question

Hello I am a TCL beginer, so please answer accordingly here are my question: 1. variable scope I built a text widget and gave it a textvariable: cmd_entry, I I sent it to a procedure where I declare it as “global cmd_entry” and give it a value The problem is that in the main program... (0 Replies)
Discussion started by: orid
0 Replies

2. Shell Programming and Scripting

RegExp question

Hi guys, does anyone know how to test for a regular expression - i want to include it in a script to make sure the variable is a regexp cheers (3 Replies)
Discussion started by: penfold
3 Replies

3. Shell Programming and Scripting

tcl: regexp matching special character

Hello Experts, Can someone help me here: I have a variable which contains a string with "". set var1 {a} set str1 {a is the element i want to match} Now "regexp $var1 $str1" does not work? ("regexp {a\} $str1" works, but var1 gets it's value automatically from another script) Is... (6 Replies)
Discussion started by: sumitgarg
6 Replies

4. UNIX for Dummies Questions & Answers

print the line immediately after a regexp; but regexp is a sentence

Good Day, Im new to scripting especially awk and sed. I just would like to ask help from you guys about a sed command that prints the line immediately after a regexp, but not the line containing the regexp. sed -n '/regexp/{n;p;}' filename What if my regexp is 3 word or a sentence. Im... (3 Replies)
Discussion started by: ownins
3 Replies

5. Programming

Tcl question

Hello guys, please help me I want to use TCl to move the lines with line number as odd number to a new file source_odd.txt, and move the lines with character 'a' to another file source_a.txt. I also want to create a tcl function to list all the file names in a appointed directory. (1 Reply)
Discussion started by: kunleoyafajo
1 Replies

6. Shell Programming and Scripting

Question on TCL regexp and match

Hello everyone, I'm new in tcl scripting. I'm currently studying a tcl script and came across this line: regexp {(\d+)(\S?)} $opts match opt swi According to my understanding, this line means to search in the opts variable for one or more digit, followed by a non-whitespace character... (2 Replies)
Discussion started by: mar85
2 Replies

7. Shell Programming and Scripting

TCL - Question regarding Braces {}

Hello everyone, What is the difference between these two tcl commands: (A) --> puts "ERROR!!! ${current_name}/${opt} is not found." (B) --> puts "ERROR!!! $current_name/$opt is not found." Are the braces needed to be put? Or both A and B has the same output? (5 Replies)
Discussion started by: mar85
5 Replies

8. Shell Programming and Scripting

Regexp in tcl

I need to change R3.1.5 as 03015 similarly R4.1.7 as 04017 i need a single command in tcl pls help ---------- Post updated at 05:19 PM ---------- Previous update was at 04:48 PM ---------- i had to do like this without using regexp set old_release "R3.1.5" ... (1 Reply)
Discussion started by: Syed Imran
1 Replies

9. Shell Programming and Scripting

Help using regexp in a TCL script ??

In a tcl script I need to find a way of reading a file, and looking for a phrase ("set myvariable") and putting the word following that into a variable. I've used a file open, and a while loop with gets to read each line from the file into a variable, and using regexp searched for the item. I'm... (1 Reply)
Discussion started by: Tonyb61
1 Replies

10. UNIX for Beginners Questions & Answers

TCL script to delete a pattern(regexp)

Hi I am writing a TCL script to delete a certain in a file My Input file module bist_logic_inst(a, ab , dhd, dhdh , djdj, hdh, djjd, jdj, dhd, dhp, dk ); input a; input ab; input dhd; input djdj; input dhd; output hdh; output djjd; output jdj; output dk; (1 Reply)
Discussion started by: kshitij
1 Replies
rsvg(1) 							   User Commands							   rsvg(1)

NAME
rsvg - convert SVG files into raster images SYNOPSIS
rsvg [--dpi-x=number] [--dpi-y=number] [--format png|jpeg] [--height=integer] [--quality=integer] [--version] [--width integer] [--x-zoom number] [--y-zoom number] infile.svg outfile.png | outfile.jpeg DESCRIPTION
rsvg converts SVG images into PNG and JPEG raster images. OPTIONS
The following options are supported: -d --dpi-x=number Set the X resolution of the image in pixels per inch. The default value is 90dpi. -p --dpi-y=number Set the Y resolution of the image in pixels per inch. The default value is 90dpi. -f, --format png|jpeg Specify the output format for the converted image. The default value is png. -h, --height=integer Specify the height of the converted image. The default value is the height of the original image. -h, --quality=integer JPEG quality value -v --version Display rsvg version information. -w, --width integer Specify the width of the converted image. The default value is the width of the original image. -x, --x-zoom number X Zoom factor, as a percentage. The default value is 1.0. -y, --y-zoom number Y Zoom factor, as a percentage. The default value is 1.0. OPERANDS
The following operands are supported: infile.svg The name of the input SVG file. outfile.png The name of the converted PNG file. outfile.jpeg The name of the converted JPEG file. EXAMPLES
Example 1: Converting an SVG Image to PNG example% rsvg myfile.svg myfile.png Example 2: Converting an SVG Image to JPEG at 300dpi Resolution example% rsvg -f jpeg -d 300 myfile.svg myfile.jpg EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/rsvg Executable to convert SVG files into raster images ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWlibrsvg | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
http://librsvg.sourceforge.net/ http://www.w3.org/TR/SVG11/ librsvg-2(3), attributes(5) NOTES
Original man page written by Dom Lachowicz (cinamod@hotmail.com), Alex Larsson (alex@redhat.com), and others. Updated by Laszlo Peter, Sun Microsystems Inc., 2004. SunOS 5.11 7 Sep 2004 rsvg(1)
All times are GMT -4. The time now is 07:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy