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
Hey guys,
Iโve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
Iโm seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, Iโve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Iโm trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
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 there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, itโs a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rustโs ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #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
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










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