Reputation: 1
This question is regarding mysql. I want to get the only characters value of min and max range. I think this is explained better with an example. Example- The column of table is username like abc123 output should be 3,12de:-o/p->2,erogan44e :o/p->7 etc. i want the select only characters length between min to max.
Is it possible without using procedure ? Should we use regular expression ?
Upvotes: 0
Views: 558
Reputation: 30849
To count the number of alphabets in a String
, you first need to replace all the non-alphabet characters with an empty space and then calculate the length, e.g.:
SELECT LENGTH(REGEXP_REPLACE(column_name, '^[A-Za-z]', '')) AS value
FROM table
ORDER BY value DESC;
The problem with this approach is, MySQL does not have REGEXP_REPLACE
function (unlike MariaDB). So, you will have to write your own function for this, have a look at this example.
Upvotes: 1