Use underscore (_) in joomla menu alias - joomla

I want to use underscore in menu alias in joomla. For a menu item called "Residential Storage" I want to use "residential_storage" as alias but when I save this it becomes "residential-storage", so underscore is being replaced by hyphen. How can I use hyphen?

Normally the alias should consist of lowercase letters and hyphens (-). No blank spaces or underscores are allowed.But to use underscore check the link below.This method will replace all (-) to (_).
http://forum.joomla.org/viewtopic.php?f=618&t=638854

Related

Routing in dotnet core 3

I am useing [Route("/{controller}/{action}/{name}")]
I have an action that takes the name of an item as an argument, and the name can have spaces in it, so when it shows in the URL they replace spaces with %20 how can I change the spaces to a dash (-) without messing the code.
ASCII Encoding Reference is a default role that you can't change it . It just replaces the original Character with another Character and does not change its value.

How to use variables with a dash in the name in Freemarker?

I'm trying to render a map that has keys containing minus signs (e.g. first-name), e.g.:
<head><title>Data - ${first-name} </title>
When I render it with FreeMarker, it complains and throws an exception. When I remove the '-' from the variable name, it works OK.
Is there any way to escape these variables in the Groovy template text?
The reason I'm doing it this way is to render a JSON blob from a 3rd party API, where I have no control over the variable-names.
Just checked the Freemarker manual. In chapter "Retrieving variables" you have the following statement:
For example, to read the variable whose name is "data-id", the
expression is data\-id, as data-id would be interpreted as "data minus
id". (Note that these escapes only work in identifiers, not in string
literals.)
These type of expressions work fine in Freemarker 2.3.23 (just tested to verify the documentation):
<#if test\-dash??>
${test\-dash}
</#if>
Only if you are using freemarker version from 2.3.22 or above. See freemarker variable syntax:
In this kind of expression, the variable name can only contain letters (including non-Latin letters), digits (including non-Latin digits), underline (_), dollar ($), at sign (#). Furthermore, the first character can't be a ASCII digit (0-9). Starting from FreeMarker 2.3.22, the variable name can also contain minus (-), dot (.), and colon (:) at any position, but these must be escaped with a preceding backslash (\), or else they would be interpreted as operators.

Why is preg_replace removing umlauts?

I am trying to create an preg_replace for my search form, but it keeps replacing umlauts too...
Code:
$zoekwoord = $this->input->get('q', TRUE);
$zoekwoord = preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]u/s', '', $zoekwoord);
Any idea how to keep special chars? (like ö)
You defined the pattern that removes any char but an ASCII letter, digit, _ and some special chars.
You need to replace the [A-Za-z0-9_] with \w and make it Unicode aware with the /u modifier.
Use
'/[^\w %[\].()%&-]+/u'
Note that only ] needs to be escaped inside this character class. /s modifier is redundant, and I believe you made a typo adding u to the end of the pattern.

Regex that considers apostrophes as word characters? [duplicate]

So I want to split a string in java on any non-alphanumeric characters.
Currently I have been doing it like this
words= Str.split("\\W+");
However I want to keep apostrophes("'") in there. Is there any regular expression to preserve apostrophes but kick the rest of the junk? Thanks.
words = Str.split("[^\\w']+");
Just add it to the character class. \W is equivalent to [^\w], which you can then add ' to.
Do note, however, that \w also actually includes underscores. If you want to split on underscores as well, you should be using [^a-zA-Z0-9'] instead.
For basic English characters, use
words = Str.split("[^a-zA-Z0-9']+");
If you want to include English words with special characters (such as fiancé) or for languages that use non-English characters, go with
words = Str.split("[^\\p{L}0-9']+");

In Regular Expression how to add Special Character's

I have regular expression like this:
regularExp = "^[-]{0,1}([0-9]|[a-z]|[A-Z]|[\s]){0," & decNum & "}\.$"
Here I need to add all Special Character's, like ~!##$%^&*()_+{}|:"<>?[]\;',./ in VB6.0
I guess you are looking for something like POSIX bracket extensions and a special character class which matches all punctuation characters without listing them explicitly.
Unfortunately you are out of luck, since the Regular Expressions available in Visual Basic 6 are provided by the same VBScript RegExp engine which was available in IE 5.5. That engine was not updated in 15 years, so many features are missing.
Having said that, your only option is to "handpick" each and every character you want to match and put them in a character class, like this
[~!##$%^&*()_+{}|:"<>?[\]\\;',./]
Fortunately you don't have to escape all special characters within character classes, only the ones which confuse the parser. (Namely \, ^, - and ])
you can use
^[a-zA-Z._^%$#!~#,-] as referance and add more special characters which you want to allow.
You can use add special characters as below
[^%$#!~#()*\s]

Resources