I need a similar function in PHP for this JavaScript function
text = text.replace(/ffc/g, "Hello");
I think preg_replace will do, but i'm not sure how to write the expression..
Hi, I'm trying to plot two functions. One is a Debye function in Matlab multiplied by some other stuff and the other is a regular function. How do I do this? Does Matlab have a toolbox for this?
So I want to iterate for each character in a string.
So I thought:
for (char c : "xyz")
but I get a compiler error:
StackCharTester.java:20: foreach not applicable to expression type
How can I do this?
In an auto-generated chart based on a query (I dragged the chart object onto a blank form to start it), the chart itself is displaying and updating properly, datawise, but I want to change the Legend from reading "SumOfAvgOfield1" and "SumOfAvgOfield2" to regular words suitable for final presentations. But I can't find a way to change it!
I'd like to bind to the element name of a node in my XmlDataProvider. I can't seem to get local-name() to work within my XPath expression. Does XAML support local-name()?
<TextBlock Text="{Binding XPath=local-name()}" />
In gawk I know two ways to test if a string contains a number. Which is best?
Method one: using regular expressions:
function method1(x) {
return x ~ /^[+-]?([0-9]+[.]?[0-9]*|[.][0-9]+)([eE][+-]?[0-9]+)?$/
}
Method two: the coercion trick (simpler):
function method2(x) {
return (x != "") && (x+0 == x)
}
Is there any reason to favor the more complex method1 over the simpler method2?
Hello, I am using Perl Regular expressions.
How would i go about ignoring white space and still perform a test to see if a string match.
For example.
$var = " hello "; #I want var to igonore whitespace and still match
if($var =~ m/hello/)
{
}
What is the warning level you use while compiling QT projects?
When I compiled with W4, I'm getting a lot of warnings such as:
C4127: conditional expression is constant
Should I compile at W3, or find other ways to handle warnings at W4, such as: adding a new header file and using pragma's(mentioned here C++ Coding Standards: 101 Rules, Guidelines, and Best Practices).
What are your practices?
Thansk.
I need to find all strings without a given string before it.
For Instance:
Find: "someValue"
**All results with "function(" before them should be ignored
The Visual Studio regularexpression would find this:
value = someValue
And Ignore something looking like this:
function(someValue)
What is the best way to go about this?
Thanks for the help!
I would like to display static (shared) objects at runtime in a PropertyGrid but if I try to set the selected object property of the grid like this:
_propertyGrid.SelectedObject = System.Windows.Forms.Application
I get a compilation error:
'Application' is a type and cannot be
used as an expression.
Is there a way to display a static (shared) object or the object's properties in the PropertyGrid?
What is the simplest possible C function for starting the R interpreter, passing in a small expression (eg, 2+2), and getting out the result? I'm trying to compile with MingW on Windows.
I have some text area field in my grails application. I got the following errors:
.PatternSyntaxException: Unmatched closing ')' near index 36 Name: note: 1) data listing ....
how could i escape the regular expressions in the text area field?
thanks.
I have sentences as shown in the below examples:
$sen1 = "The quick brown fox jump KEYWORD over123 the3 lazy dog, fox is quick";
$sen2 = "The quick brown fox jump123 KEYWORD over the lazy dog, fox is quick";
i want to use the keyword 'KEYWORD' as my search string to extract the alphanumeric words before and after the search string using Perl regularexpression.
sample output:
over123
jump123
NB: The word 'the3' is left out because i'm only searching for alphanumeric words exactly before or after the 'KEYWORD'.
Thanks
Yahoo has separate map for India ( which has more details than the regular maps.yahoo.com) at http://in.maps.yahoo.com/ . But when I use the API it goes to default map. How do I get API access to YMaps India?
One of my co-workers wrote an ActionResult that accepts a Predicate as its input parameter. We need to call this method through jQuery - but obviously that doesn't work. Is there any way to pass a query through a method in jQuery that it will accept?
public ActionResult List(Predicate<TModel> expression)
{
// ...
}
$('#item').load('/list', //... ???
)
I have a library that draws regular bezier path figures (complex paths formed of a lot of bezier points), using midpoint approximation.
I can draw them without problem, but I need to add support for advanced geometry operations: Nearest point of a curve, intersection, figure contains point, and more importantly, path combinations: difference, intersection, exclusive-or, union, ...
Is there any good source to get all this?
Thanks
Hey all!
My web.config no longer has Intellisense nor colour highlighting. It looks like a regular text document. Any idea why this would occur?
Thanks!
On lots of sites now, you can see a Facebook "Like" Button.
- When depressed, it changes background color.
- When mouse-overed, it allows you to write some additional text
I love this interface - lightweight action, but allow for expression of more data if the user wants to.
Anyone has written a similar plugin?
how to set background image in submit button?
I have to use a image in place of regular submit button? which way would be best in xhtml/css?
Button should look same in all main browsers including IE6,IE7
My application requires the user to enter their business name, which the application will automatically create into a unique identifier to be used in URLs, ie
"Bob's Cafe" will become "bobs-cafe"
But if there are duplicate names I would like the application to add a number so if there is already a "bobs-cafe" we will use "bobs-cafe-1" and likewise if there is already a "bobs-cafe-1" we will use "bobs-cafe-2"
Ive used explode and also looked at a regular expressions but I dont know the best way to approach this.
Im stuck in being able to grab the number and incrementing it and returning the string
I am writing a forum in Python. I want to strip input containing the right-to-left mark and things like that. Suggestions? Possibly a regular expression?
Hello,
I am trying to create a regularexpression in C# that allows only alphanumeric characters and spaces. Currently, I am trying the following:
string pattern = @"^\w+$";
Regex regex = new Regex(pattern);
if (regex.IsMatch(value) == false)
{
// Display error
}
What am I doing wrong?
Thank you!
Seriously, why can't I parse a string with angle brackets using the Javascript regularexpression object?
var r = new RegExp(), r;
r.compile("\\<div\\>", "g");
r = r.exec("<div>Hello</div>"); //Equals null yo
Why does that not work?
Hello everyone,
I am trying to assign a regularexpression result to an array inside of a bash script but I am unsure whether that's possible, or if I'm doing it entirely wrong. The below is what I want to happen, however I know my syntax is incorrect:
indexes[4]=$(echo b5f1e7bfc2439c621353d1ce0629fb8b | grep -o '[a-f0-9]\{8\}')
such that:
index[1]=b5f1e7bf
index[2]=c2439c62
index[3]=1353d1ce
index[4]=0629fb8b
Any links, or advice, would be wonderful :)
I am a php beginner and seed on the forum such a php expression:
$regex = <<<'END'
/
( [\x00-\x7F] # single-byte sequences 0xxxxxxx
| [\xC0-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
| [\xE0-\xEF][\x80-\xBF]{2} # triple-byte sequences 1110xxxx 10xxxxxx * 2
| [\xF0-\xF7][\x80-\xBF]{3} # quadruple-byte sequence 11110xxx 10xxxxxx * 3
)
| ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111
| ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111
/x
END;
is this code correct? what should mean some strange (4 me) constructions like <<< 'END' / /x and END;
thanks