Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:10:33+00:00 2026-06-08T17:10:33+00:00

I have a string which is decoded as base36, ie 0-9a-z, any other characters

  • 0

I have a string which is decoded as base36, ie 0-9a-z,
any other characters were decoded as follows: a unicode character code, converted to base36 and preceeded by capital letter ‘A’, and followed by letter ‘B’.
If multiple unicode chars appear, only the last one if followed by ‘B’.

Example:

zergme@wtfd-婴儿服饰.com

converted as:

zergmeA1sBwtfdA19Ahv8Ag1rAkctAub4A1aBcom

It was convenient to convert the data that way, but now I’m bashing my head on how to write a decode it back algorithm.

I already provided for a function that convert charcodes to the Unicode chars, which let be called ‘unichr($code)’;

…but I can’t think of a good way finding these chars.

I was trying to use regexp first, something like:

preg_replace('/A.*?B?(?=[AB])/',"$1",$mail);

But it didn’t work the way I wanted… And I also didn’t realize how to cast my custom convertion function aka ‘unichr()’ on the matches.

Then I was also thinking about manually finding chars with strpos(), but it also turned out to be messy.

Could you advice some pattern? Or whether I should elaborate on regexp or try to use some loop? I’m kinda blank… Thanks 🙂

LOLMAO

That is it, Looks like I figured out, thanks to your contribution:

'/A(.*?)((?=A)|B)/'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:10:35+00:00Added an answer on June 8, 2026 at 5:10 pm

    Have you looked into using preg_replace_callback() instead? It takes a function instead of a string as the replace value, and will pass the matches to the function and use the function’s return value as the replace string.

    Loose example, you’ll have to play around a bit

    <?php
    $str = 'zergmeA1sBwtfdA19Ahv8Ag1rAkctAub4A1aBcom';
    
    function convert_to_unicode_cb( $match )
    {
        // $match1 would be 1s, 19, hv8, etc
        return unichr( $match[1] );
    }
    
    preg_replace_callback( '/A(.*?)(?=A|B)/', 'convert_to_unicode_cb', $str );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string cityName which I decoded into bytes as follows: byte[] cityBytes
I have a string which I need to verify if it's a Country code.
I have one string which is base 32 bit decoded now I want to
I have a string that represents an HTML block. All the unicode characters are
A have a string %c3%ad which decoded with UTF-8 is í , but decoded
I have a string which is of about 1mb size. The requirement is to
I have a string which is in the following format, When there is a
I have a string which varies everytime it is input as it is a
I have a string which is a representation of a clojure map. Is there
I have a string which typically is in the format : 0xFF . I'll

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.