substring string by ant - ant

Could somebody help me.I would like to get substring of string by ant.For example I have path d:\Folder_for_Ant\Incremental_Build\My.ear\Common\classes.jar I would to get word "Common" by substring this path.How to do it?

You should use propertyregex.
Or you could use scripting (scriptdef) where you could use javacript

Related

Xtext - Check whether string is URL

I'm completely new to Xtext so thanks in advance for your help.
I have the following:
terminal PATTERN_SRC : STRING '.png';
Pattern: name='pattern:' value=PATTERN_SRC;
I want the user to code it like this:
pattern: (URL to image ending with .png / .jpg / .gif)
Currently I'm checking it like this but this does not work.
Is there a nice way to solve this? Thanks in advance!
Sone remarks:
Don't use the feature name. This is a reserved keyword for calculating unique names of an element in a resource.
STRING is like this: "Sometext".
So what you want is "somefile.png"
What you described is "somefile".png
You could just use STRING and implement a validation rule to ensure your URL is valid.

Need some help regarding .net mvc URL routing/rewriting

URL is something like
/home/rawstring13245/rawstring534533453
I want the rule that saves only 13245 to parameter and 534533454 to another but ignore raw strings before them.
how to achieve it in route.config file?
i want this because strings are not parameters , I need only parameters out of string
like:
url:"{controller}/rawstring{action}/rawstring{id}",
what to enter in place of raw string? I don't need those strings. and yeah each raw string is of same length= 10
You can get complete variables as strings and get your desired part by using the sub-string method. Its the quickest solution, i thought it solve your problem.

Regex that Detects specific string pattern

I'm new to Regex. The question asks me, Come up with a Regex that Detects specific string whether in start, middle or end of a string with Regular Expressions?
Try it yourself before checking the solution below:
I first thought the solution would be this:
(?:^\s+)|(?:\s+$)
The solution is this:
(?:\s|_)ra(?:\s|_)
How does this Regex work?
Can you walk me through each step?
What does this line of Regex do? Please help me out.
I was able to find answer to my question. I will close the post now.

Find all URL's in a string in rails 3

I'm building an app in Rails 3 and I need a method to extract all urls from a string and store them in a hash or something. I know I need to use regular expressions but I don't know where exactly to begin with them.
Also, I know about auto_link, but it doesn't quite do what I'm trying to achieve. I just simply need a hash of all the url's from a string.
Thanks!
From http://www.regular-expressions.info/ruby.html
"To collect all regex matches in a string into an array, pass the regexp object to the string's scan() method, e.g.: myarray = mystring.scan(/regex/)."
So you probably need strings that start with "http". So check the docs for that :)
I don't program in Ruby and I'm not very good with regex but maybe this will help you out:
http://www.ozzu.com/programming-forum/url-regex-t104809.html

elaborate urls with regex

i have a string that maybe contains text with links.
I use these instructions for elaborate it:
message = message.gsub(/http[s]?:\/\/[^\s]+/) do |m|
replace_url(m)
end
if the string is "http://www.youtube.com/watch?v=6zToqLlM8ms&playnext_from=TL&videos=qpCvM5Ocr3M&feature=sub"
the instructions works.
but if the string is "hi my video is http://www.youtube.com/watch?v=6zToqLlM8ms&playnext_from=TL&videos=qpCvM5Ocr3M&feature=sub"
doesn't works
why?
how can i do?
thanks
Beucase this not match a pattern. Get before url add expression to catch some crap before url.
You can also try match a regex pattern to every word. Because url is always one word separated word.

Resources