Problem with copy and paste from Google

Hi folks!
This is my first post to the forum. Please forgive, but inform me, if I make any mistakes with the rules or protocols here.
I just installed Obsidian for Android on my phone a few days ago.

I’m doing a lot of research using Google’s search-AI mode.
Then I copy what’s relevant to me and paste it into an obsidian note.
If I paste it as “plain text” all of the tables, bullet points, etc just turn into a jumbled mess. That’s expected.
If I use “paste” most of the note looks great.

Here’s my problem, most of my search results have temperatures and chemical abbreviations. Many of those just completely explode when they’re pasted into a note.
Example:
Ratios: generally composed of <78% Silica(SiO2) and

Becomes:
Ratios:** Generally composed of

(Dead images link gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)

<78%

<78%

 Silica (

(Dead images link gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)

SiO2

SiO2

) and 

Those broken image links are hidden until you try to highlight them to remove them. Some of them are huge and there can be a lot of them with the searches I’m making.

Is there a way to remove all of those from a note at one time while keeping the rest of the page formatting? Maybe a plug-in?

I tried searching the community plugins but didn’t have any luck. Maybe I just wasn’t using the right search terms

To remove the images

Use this plugin: Regex Find/Replace
With regular expressions, you can find patterns like gif;base64. I’m not too familiar with this format, but I assume it would be easy to identify the beginning and the end of any image. However you would need to do that manually for each note, that sounds annoying.

To convert the images (Base64 to PNG)

Use this plugin: Convert Base64 to PNG
I would probably use that one, see the features below:

  • Base64 Detection: Automatically detects base64-encoded images in your notes
  • Local Conversion: Converts base64 images to local PNG files
  • Batch Processing: Process individual files or all files in your vault
  • Customizable Storage: Configure where and how PNG files are stored
  • Automatic Conversion: Option to automatically convert base64 images when pasting

Thank you Grimoire!

Thanks to your instructions, I was able to find it and install it easily.
But figuring out how to access it was another story. So far I’m climbing a steep learning curve using Obsidian. But I finally got it installed to the editing toolbar.

I spent much more time trying to figure out how to make a good regex search. I used to be pretty good at it about 25 years ago. Either I’ve gotten rusty or it’s changed. Probably the former.

I finally came up with one that is doing exactly what I want. It’s pulling the links to worthless image files but it’s leaving any useful hyperlinks alone.

I’m going to list the search expression below here. I added spaces between each of the characters so that it has a chance of being readable or accepted by the forum. You’ll have to remove those before the expression will work.

\ ! \ [ ( . * ? ) \ )

Oh, and a shout out to Martin Eder. Nice tool that you made thank you!

BUT, I still had a problem. Even after stripping the image files out it still had multiple line returns and duplicated equations messing things up.

I tried to make a RegEx expression to fix those but finally gave up. I don’t think Martin’s plug in works on line breaks.

I found Elias Jaffe’s “Remove Newlines” plug-in( thanks Elias!).

I still have to find each problem section one at a time, remove one of the duplicate expressions and then highlight over the area and use Elias plug in. Then move on to the next one.

Not a one click solution but this combination sure makes it easier and faster to clean this mess up.

1 Like

Just spotted the base64 info. Thank you, may come in useful sometime. But the images that Google was putting in there were nothing but a nuisance and a waste of file space

I don’t have a lot of experience with regex, so I’ll let you deal with that. You can use back ticks in the forum to display code (like in Obsidian) or use the </> icon:

\!\[(.*?)\)

You got me on that one. What is a back tick?

`

This is a backtick. And three of them triggers a code block that doesn’t auto-format.