Skip to content

Commit

Permalink
Use regex to strip similar chars
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Nov 25, 2024
1 parent 8cc7ee7 commit 5ad5062
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/main/java/no/ndla/taxonomy/util/PrettyUrlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,13 @@ private static String cleanString(String name) {
return Jsoup.parse(name)
.text()
.toLowerCase()
.replaceAll("[.,!?()/«»'¡:`’#]", "")
.replaceAll("æ", "a")
.replaceAll("ø", "o")
.replaceAll("ö", "o")
.replaceAll("å", "a")
.replaceAll("ä", "a")
.replaceAll("á", "a")
.replaceAll("ï", "i")
.replaceAll("í", "i")
.replaceAll("é", "e")
.replaceAll("[.,!?()/«»'¡:`’#°π]", "")
.replaceAll("[æåäáǎ]", "a")
.replaceAll("[øöô]", "o")
.replaceAll("[ïíǐ]", "i")
.replaceAll("[éè]", "e")
.replaceAll("š", "s")
.replaceAll("č", "c")
.replaceAll("ü", "u")
.replaceAll("1D45-B7C5", "d")
.replaceAll("–", "-")
Expand Down

0 comments on commit 5ad5062

Please sign in to comment.