9mm
Iโm trying to make a regex to remove emojis based on this thread:
This causes an error:
Regex.replace(~r/[\u{1F600}-\u{1F6FF}]/, "๐ฐ Monies! ๐ฒ", "")
# (Regex.CompileError) PCRE does not support \L, \l, \N{name}, \U, or \u at position 2
I tried using \x{FFFF} syntax instead according to this: Regex Tutorial: Introduction to Unicode Regular Expressions
But I get another error:
Regex.replace(~r/[\x{1F600}-\x{1F6FF}]/, "๐ฐ Monies! ๐ฒ", "")
# (Regex.CompileError) character value in \x{} or \o{} is too large at position 9
Apparently I also need u to enable unicode but that doesnt seem to work either:
Regex.replace(~r/[\x{1F600}-\x{1F6FF}]/u, "๐ฐ Monies! ๐ฒ", "")
"๐ฐ Monies! ๐ฒ"
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
Iโm trying to build a basic Phoenix web-app, and Iโd like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a โmatch makerโ for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixirโs Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Iโm working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
Iโve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenixโs authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 โ Documentation
A bit of explanation for the slightly c...
New
Hey, Iโm Jesse and Iโm the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very ฮฑ version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
Weโve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kip
You might have some better luck using the unicode character class
So(other symbol). For example:BTW, the โcorrectโ approach to this would be:
But erlangโs
remodule doesnโt support that character class.9mm
Interesting.. does that strip other languages or only emojis? I was trying to avoid stripping chinese/japanese/korean, which it seems like a lot of emoji regex do
kip
No, it doesnโt. The full list of code points in
Soare here: Unicode Characters in the 'Symbol, Other' CategoryItโs more permissive than just emoji, but it does not include scripts.
9mm
Hmm yess, and it also is missing some emoji for some reason. God this is confusing
9mm
Can you try this string?
It leaves the other languages properly but some emojis are left.
9mm
I did find this guys ruby gem but I just wasted like an hour trying to convert this regex and when it finally worked it erased all the chinese characters, so obviously I got that wrong
https://github.com/guanting112/remove_emoji
mudasobwa
There are many issues here. Both characters above are not in the range you specified in the first place.
To make it work for the range with
\u, just interpolate the literals (I voluntarily changed the starting value for the range to what it probably should be):\xwill work out of the box with a proper range:kip
Yes, I see the same. Itโs a bit surprising since according to some utility code I wrote they look to be
Sobutrecertainly doesnโt agree:kip
Seems that emoji belong to the
Commonscript so this appears to get closer - but it also deletes digits and punctuation.9mm
That is good but it removed tons of numbers and such, so Iโm nervous about using that as I have no idea what all itโs going to remove