XSLT Replace function not found

The replace function is only available in XSLT version 2.0, not in version 1.0 which is what Visual Studio uses. Just because you’ve specified version=”2.0″ doesn’t mean that Visual Studio supports it. Here’s a template on codesling that implements string-replace in XSLT 1.0. You should be able to use it but I can’t vouch for … Read more

How to change diacritic characters to non-diacritic ones [duplicate]

Since no one has ever bothered to post the code to do this, here it is: // \p{Mn} or \p{Non_Spacing_Mark}: // a character intended to be combined with another // character without taking up extra space // (e.g. accents, umlauts, etc.). private readonly static Regex nonSpacingMarkRegex = new Regex(@”\p{Mn}”, RegexOptions.Compiled); public static string RemoveDiacritics(string text) … Read more

Regex : how to get words from a string (C#)

Simple Regex: \w+ This matches a string of “word” characters. That is almost what you want. This is slightly more accurate: \w(?<!\d)[\w’-]* It matches any number of word characters, ensuring that the first character was not a digit. Here are my matches: 1 LOLOLOL 2 YOU’VE 3 BEEN 4 PWN3D 5 einszwei 6 drei Now, … Read more

Search and replace multiple values with multiple/different values in PHP5?

You are looking for str_replace(). $string = ‘blah blarh bleh bleh blarh’; $result = str_replace( array(‘blah’, ‘blarh’), array(‘bleh’, ‘blerh’), $string ); // Additional tip: And if you are stuck with an associative array like in your example, you can split it up like that: $searchReplaceArray = array( ‘blah’ => ‘bleh’, ‘blarh’ => ‘blerh’ ); $result … Read more

how to use a regular expression to extract json fields?

/”(url|title|tags)”:”((\\”|[^”])*)”/i I think this is what you’re asking for. I’ll provide an explanation momentarily. This regular expression (delimited by / – you probably won’t have to put those in editpad) matches: ” A literal “. (url|title|tags) Any of the three literal strings “url”, “title” or “tags” – in Regular Expressions, by default Parentheses are used … Read more