[Question]
  [
Given a string `x`, output the characters in `x` sorted according to the order of appearance in your source code. 
## Examples
```
Source: ThisIs A Test
 Input: Is it a Test?
Output: TissI   etta?
Source: Harry - yer a wizard.
 Input: I'm a what?
Output: aa  wh'?Imt
Source: Mr. H. Potter, The Floor, Hut-on-the-Rock, The Sea
 Input: 
Output:
```
## Rules
* Standard loopholes & i/o rules apply
* Input & output can be either a string, a list of characters, or a list of bytes.
* If a character is used multiple times in the source, use the first occurrence.
* If one or more characters does not appear in the source, they should be at the end; their order does not matter, nor does it have to be consistent.
* **Source must be non-empty**
* Newlines are treated the same as other characters.
* The order in which the code is executed doesn't matter; just the raw string.
* The input is in the same encoding as the code.
* The input is sorted by characters, not by bytes.
* Sorting is case sensitive
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes for each language wins!
```
let f = (s, i, o) => o.split("").map(x => [x, s.indexOf(x) == -1 ? s.length + 100 : s.indexOf(x)]).sort(([, a], [, b]) => a - b).map(([x]) => x).join("") === o && i.split("").sort().join("") === o.split("").sort().join("");let g = (s, i) => i.split("").map(x => [x, s.indexOf(x) == -1 ? s.length + 100 + Math.random() : s.indexOf(x)]).sort(([, a], [, b]) => a - b).map(([a]) => a).join("");$(() => $("button").click(() => $("#result").text(f($("#source").val(), $("#input").val(), $("#output").val()) ? "Valid" : `Invalid; example output: \`${g($("#source").val(), $("#input").val())}\``)));
```
```
body,label{display: flex;flex-direction: column;}*{white-space: pre;font-family: Inconsolata, Consolas, mono-space;font-size: 14px;}
```
```
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><label>Source: <textarea id="source">ThisIs A Test</textarea></label><label>Input: <textarea id="input">Is it a Test?</textarea></label><label>Output: <textarea id="output">TissI   etta?</textarea></label><div><button>Validate</button> <span id="result"></span></div>
```
  
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), ~~102~~ ~~100~~ ~~96~~ ~~85~~ ~~79~~ ~~76~~ ~~68~~ ~~61~~ ~~59~~ 60 bytes
```
c="print(sorted(x:=input(),key=('c=%r;'%c+x).find))";exec(c)
```
[Try it online!](https://tio.run/##K6gsycjPM7YoKPr/P9lWqaAoM69Eozi/qCQ1RaPCyjYzr6C0RENTJzu10lZDPdlWtchaXTVZu0JTLy0zL0VTU8k6tSI1WSNZ8/9/RSVlFVU1dQ1NLW0dXT19A0MjYxNTM3MLSytrG1s7ewdHJ2cXVzd3D08vbx9fP/@AwKDgkNCw8IjIqOiY2Lj4hMSk5JTUtPSMzKzsnNy8/ILCouKS0rLyisqq6praOgA "Python 3.8 (pre-release) – Try It Online")
*-2 bytes by using [this](https://codegolf.stackexchange.com/a/62/83048)*
*-4 bytes by realizing that `<0` == `==-1` and removing the unnecessary `+1`*
*-11 bytes thanks to Neil*
*-6 bytes thanks to dzaima*
*-3 bytes thanks to rod*
*-8 bytes thanks to negative seven pointing out that the program can output a list of chars*
*-7 bytes due to Embodiment of Ignorance switching back to Python 3.8 and using `:=`*
*-2 bytes due to Jo King switching out the variable name s for c, so we could leave out the `;c`*
*+1 bytes because negative seven pointed out that it wasn't filtering `;` correctly*
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 14 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Anonymous tacit prefix function.
```
'''∘⍋⊃¨⊂'∘⍋⊃¨⊂
```
`⊂` enclose argument (to act on it as a whole)
…`⊃¨` from that, pick one character for each of the following indices:
`∘⍋` the indices that would sort the argument in the the order given by the following string (all non-members go in order of appearance at the end):
`'''∘⍋⊃¨⊂'` the characters `'∘⍋⊃¨⊂`
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///X11d/VHHjEe93Y@6mg@teNTVhMb9n/aobcKj3r5HfVM9/UGC640ftU0E8oKDnIFkiIdn8P80BXXPYoXMEoVEhZDU4hJ7dS6QiLp6LlCgPCMRKgAm6nJzdTVANnQ1qwMA "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 48 bytes
```
n=>n.OrderBy((@"n=>.OrdeBy(@""+)Ixf"+n).IndexOf)
```
[Try it online!](https://tio.run/##JczZWoJAGADQe9@isWwmBCvbWSTNhaJot4UWHGZ0Sn9rgIK2Vyc@vTw3h0YqjUTeSYAaUSwFDKtOG5IJk8FgzAw6CqRlcTMH0wLNkyGTzQxjGxWesZCNkEKclCMFiOZAyFKPk1wv9aWImSuA4XmstaZAgxhzjBZ8VF5cqixjsqJUVa22urZe39jc2t7Z3dMN02rY@83WQbvT7TmHR@7xiXd6dn5xeXXdv7m9u/f9h8en52BAQ8aHI/HyOp7A9O1dRnHy8ZlmX98/v3@IEKLn/w "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~60 58~~ 56 bytes
*-2 bytes from Jo King*
```
f=_=>_.sort((a,b)=>(p=g=>`f=${f+g}`.indexOf(g))(a)-p(b))
```
[Try it online!](https://tio.run/##FcxBCsMgEEDRq4ShixlqvMF4hR6gFKNGJSWoxBAKpWe3uvhv@d/mMtUdWznnlFffWmDNSsuajxPRCEussHBktQS@fcM9/ha5pdV/HgEjERqaC1qi5nKqefdyzxEDPiGAmMAM7MANpgEP8qCCANXTPYZXn/wB "JavaScript (Node.js) – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
“;fɓḟṾⱮ”ṾɓfⱮ;ḟ
```
A full program accepting a (Python formatted) string (of Jelly [code-page](https://github.com/DennisMitchell/jelly/wiki/Code-page) characters) which prints the output.  
(as a monadic link it yields a list of lists of characters)
**[Try it online!](https://tio.run/##hY47DsIwDIav4gs0EnMQR0EKiasWVU3lOEO33qErFTdAYoOFvcdoLhJcHnO3T7//h8/YNH3Oabjoch6Xx3V5vtL9loZJYB5LYS1qzhmUUlwh2MqQsYwUoG7ho3iHUBzEpsW@1kjHMAkLiCo1Wga2Nrby@wKwdRA7CJ4YHZz6db4m2AUGb20kwtbi/63gI9nfd0cwEu0ig@HvkQ2xegM "Jelly – Try It Online")**
### How?
```
“;fɓḟṾⱮ”ṾɓfⱮ;ḟ - Main Link: list of characters, S
“;fɓḟṾⱮ”       - list of characters = [';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ']
        Ṿ      - un-evaluate = ['“', ';', 'f', 'ɓ', 'ḟ', 'Ṿ', 'Ɱ', '”']
         ɓ     - start a new dyadic chain, F(S, T=that):
           Ɱ   - for each character, t, in T:
          f    -   (S) filter keep any of (the single character, t)
             ḟ - (S) filter discard any of (the characters in T)
            ;  - concatenate
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 56 bytes
```
<slurp.comb.sort({"<$_>~EVAL$^a".index($a)}).say>~~.EVAL
```
[Try it online!](https://tio.run/##FcnnGoFQAADQVyGhjGvvZGZm75mWmUqJMnr163P@HlXUpCSEhC4Zmgp45coBXdHu2BshUIa0qWmJRrcsAk6yIJoYyuJfHOisRdo2@B@EDifiQt0eL4b7/IEgCIUj0Vg8kUylM9kckScLxVK5UqVq9Uaz1aY73V5/MByNJ9PZfLFcrTdbZsdyvCDuD8fT@SJdZUW9afrdeDxN6/X@fO0f "Perl 6 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~16~~ 14 bytes (Jelly Code page), 25 bytes (UTF8)
```
“Ṿv`Ṿ;³³i@Þ”v`
```
[Try it online!](https://tio.run/##y0rNyan8//9Rw5yHO/eVJQAJ60ObD23OdDg871HD3LKE/3jkAA "Jelly – Try It Online")
A full program that takes a single argument, the string to be sorted. 
Thanks to @JonathanAllan for pointing out a bug!
As per @EriktheOutgolfer, although the code can be input using the Jelly code page, the characters sorted are the equivalent UTF-8 ones rather than the bytes of the source. As such, I’ve included the score in UTF-8 bytes as well. Note the same probably applies to all languages with custom code pages. 
### Explanation
```
“Ṿv`Ṿ;³³i@Þ”   | The string "Ṿv`Ṿ;³³i@Þ", referred to below as S
            v` | Evaluate this string as Jelly code using the string itself as the argument
```
The string above evaluates as:
```
Ṿ          | Uneval the string S (effectively wraps it in “”)
 v`        | Eval it (effectively removes the “”)
   Ṿ       | Uneval it again, adding back in the “”
    ;³     | Concatenate the input to this
      ³i@Þ | Sort the input with respect to the first occurence of each character in the “”-wrapped string S concatenated to the input
```
`Ṿv`` is a no-op effectively here, but exists to ensure all characters are represented.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 57 bytes
```
->s{s.sort_by{|o|%{->s{.ort_by|%}index()9}.index(o)||99}}
```
[Try it online!](https://tio.run/##JcvfCoIwGIfh867ix0BQWIP@N1BvRCTmnORJxlbU2rdrX5ZnLw@89tn5NFRpXbvghJvs49L5QBNl4UdiAcrieOvNOy9kFEtNBZGUMSatnHGowLyxUHiNH2V7jquy1jMOFkJZUl3HyDjbbHf7w/F0lnOz1f8URukrAkgT7jkazTE0Wuj5dy1aFIjpCw "Ruby – Try It Online")
Fairly straightforward, assuming I haven't missed a golfing trick. Take in a list of characters and sort by their index in a string consisting of all the uniq characters in the code in order of their appearance. Often their first appearance is in that very string, but that doesn't change the order.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~24~~ ~~22~~ 21 bytes
```
Σ"Σ"'"«"'«Rrk}"«Rrk}R
```
[Try it online!](https://tio.run/##yy9OTMpM/f//3GIlIFJXOrRaSf3Q6qCi7FolCBUEkstIzTm3OCff2ES9FgA "05AB1E – Try It Online")
**Explanation:**
```
Σ                    }               # Sort
 "Σ"                                 # Σ string literal
    '"                               # " string literal
       «                             # Concatenate last two literals
        "'«Rrk}"                     # '«Rrk} another literal
                «                    # Concat again
                 R                   # Reverse literal (so: }krR'«'"Σ)
                  r                  # reverse stack 
                   k                 # find the current sorting index in our code string 
                     R               # reverse our sorted string
```
First time trying stuff in 05AB1E so probably lots to be saved
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~31~~ ~~26~~ 19 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Σ'"'ÿs"Σ'ÿÿsìyk"ìyk
```
-7 bytes by taking inspiration of [@EmbodimentOfIgnorance's approach in his C# answer](https://codegolf.stackexchange.com/a/187443/52210) of appending the current character before indexing.
[Try it online](https://tio.run/##FYvBCcQwDARbEfqoh6sjDTiJwEEHBiv3cD36pgc/9FdLPoVZlnnsNi37xWuFEZJPxRSfKf4MwbfW2iorw1FLL8fNXUFr@31P2Bm09ZvPDwyfwx@lsDyG@cQMCaEgIhGJqI5cJPMlLOwP) or [try it with added debug-line to see the strings that's being indexed into](https://tio.run/##FYuxDcMwDARXEdiwyQQGskUWkG0CChhAgOgULDyNWu2ggj1XUhjcF1fcV8n7m9byjoA2BUJshthQBhtP5fux1quQUDpKbvm4qEmSUr@fM@2UpLaLzi2pTbUh6D2@3m1CDBmBAQARmUU0imD@8e79Bw).
**Explanation:**
```
Σ                 # Sort the (implicit) input-string by:
 '"              '#  Push string '"'
   'ÿ            '#  Push string "ÿ"
     s            #  Swap the order of these two strings on the stack
      "Σ'ÿÿsìyk"  #  Push string "Σ'ÿÿsìyk", where the `ÿ` are automatically filled with
                  #  the previous strings we created: `Σ'"ÿsìyk`
                  #  (top to bottom from stack; left to right in string)
       ì          #  Prepend this string in front of the character we're sorting
        yk        #  And then get the index of the character we're sorting in this string
                  # (after the sorting the resulting string is output implicitly)
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 37 bytes
```
≔´≔´´´η´Ｆ´Φ´θ´⁼´ι´κ´¬´№ηＦηΦθ⁼ικΦθ¬№ηι
```
[Try it online!](https://tio.run/##S85ILErOT8z5//9R55RDW8AECJ7bfmjL@z3LgAwQ3gGUadwDZOwE4l1A@TVAgZZp57YDlZzbfm7ZuR1A6XM7z@0CMQ@tAUud24luJkHzQNYSMBMA "Charcoal – Try It Online") Explanation:
```
≔´≔´´´η´Ｆ´Φ´θ´⁼´ι´κ´¬´№η
```
There are two ways of quoting characters in Charcoal; `´` quotes any single character while `”y`...`”` quotes any character except `”` and also counts as a separate string. It turns out that the overhead in having to deal with `”` means that it doesn't end up any golfier.
```
ＦηΦθ⁼ικ
```
Loop over the characters in turn, outputting any matching characters from the input. This sorts the input.
```
Φθ¬№ηι
```
Output any unmatched characters in the input.
[Answer]
# [J](http://jsoftware.com/), 14 bytes
Anonymous tacit prefix function.
```
]/:']/:''i'i:]
```
[Try it online!](https://tio.run/##TcihCoAwGEXhvqe4WC6CzOUfxGy3ycIQhxOmYYIWn31q0nDg8C3Zp0bDQGCyrYVvDAxic6kKDfpGExUugU9KTeO8wYNdQtjh0E9pb/kxGR89ZvfX74YY1jq60wrzDQ "J – Try It Online")
`]` the argument
…`i:` last occurrence (non-members get the index beyond end of lookup string) of each character in:
`']/:''i'` the characters `]/:'i`
…`/:` use that to sort:
`]` the argument
[Answer]
# Java 10, ~~129~~ 100 bytes
```
s->{s.sort(java.util.Comparator.comparing(c->("s->{.ort(javuilCmpcng\"\\+)dexOf;}"+c).indexOf(c)));}
```
-29 bytes by porting the `+c` from [*@EmbodimentOfIgnorance*'s C# answer](https://codegolf.stackexchange.com/a/187443/52210).
[Try it online.](https://tio.run/##lVL7V9MwGP2dvyLGB62l8f2iUMUpDgWGbD4paJZmW0qb1CQdG3P@6zPJqjyc5@hdz06/fje53@NmeIjDLD2ekRwrBXYw45MlABjXVPYwoWDXhgAMBUsB8TJDR5VmOdpmSq81BlhiYqgxUH5kiNMl86c01oyAXcDBOpipMJ4opITU5043RFGao1pIRNwr432PhLEHLR3V5IrljaIkvJ/AJAn8lI5avWgKA@Ijxl3kEd/3o@kssrpl1c2Nbi3vKi5MP15b2@sPDgH2581oqrQHOwOmgHmwi6Gr/1euiaUcgxCMqTT5E3aKZYouUnYkAk0E9oQ2/a@AzoCCzVwI89qsdCh4qAc03BfkeJ5rU3zx/P/NJfnLYBI7mnPDSRZM56Ju4n6ehW8RBGEYIocoiuO40Wi1EgfsQCzSlNJer99nBlmW50VRcM6FRVmW0kIZaIOqGg5Ho8lkekn3SgKvXrt@Y9nzbwYrIbp1@87de/cfPHz0@MlqtLYeP3228bzx4uXmq@bW6zfbO7utvbf77c679x8@fvp8kCSHR1@@4i5Jaa8/YNlxXnBRfpNKV8OT0fh08n36A/5hQOcAJz53gHF1WenaA@2x0rRAotKoNEmdcw9u2fwqSCAMHDVYhst1D2cr2pASjy@7PzexMTunJ4uYnrsNEcNXno8KXHZEq5u5xdqPvlkZEXlOyXkvKC0pLowlXEJIhbRwt9mluqI4Ip5VrsNFLbUq/bsnS61vnVdhCyABhP@mngnGrR2NZc7mskCz3sN09hM)
**Explanation:**
```
s->{                 // Method with char-List parameter and no return-type
  s.sort(java.util.Comparator.comparing(c->
    ("s->{.ort(javuilCmpcng\"\\+)dexOf;}"
                     //  Push a String containing the characters in the code
     +c)             //  Append the current character
        .indexOf(c)  //  And get the first index of the current character in the String
```
NOTE: Usually it's cheaper to use `s.sort((a,b)->Long.compare(a,b))` instead of `s.sort(java.util.Comparator.comparing(c->c)`, but in this case it would be 11 bytes longer:
```
s->{var v="s->{var =\"\\;.ot(,)Lngcmpe+idxOf}";s.sort((a,r)->Long.compare((v+a).indexOf(a),(v+r).indexOf(r)));}
```
[Try it online.](https://tio.run/##jVNtW9MwFP3Or4j1hdSuEXx3ZZs4xaGDIZuvFDWk2dbSJjVJy8acf30mWXGCfPC0T58m9zT33nNPE1xiP4lOFyTFUoI9HLPZGgAxU1QMMaFg3ywBKHkcAQITTUeFilPUjaXaao@xwERTm0C6gSbO1/RDKqxiAvYBAw2wkH5zVmIByoZz8doInTAMEFew5nbZiGQ59eJo0hvOnUAiyYWCENeE6ze7nI0Q4VmOBYWw9LCLYhZRTYXYrekNsdoQrusG80VgSsiLk1SXUFVii890a7CvRMxGR8cAu8u@FJUKOoNxLIG@sV07tpWLWAcLMQU@mFKh42fxORYRukzZEwh0EDjgSktRA4MxBTsp5/q1UyifM1@NqX/Iyeky1qf48vdGl6rvlcBt2zVWXFQC6MIh8ZswtHxUsYs4bWc5YSOtamh0DUMrhxtsbbQ26/PQ8chKI2I1upwd6K/0BQ1cA8/3fWSxsVkPgq1Gs9lstdu9XmiBLYhBFFE6HI5GsUaSpGmWZYwxbpDnuTCQGkqjKMpyMpnN5ley3widm7du31mH7l2v5qN7G5v3Hzx89PjJ02d1k7n1fPtF@@Wrnded3Tdvu3v7vYN3h/3B@w8fP33@chSGx1@/fccnJKLD0ThOTtOM8fyHkKoozybT89nP@S/nH19aN9jkSzdos@eFqvzQn0pFM8QLhXIdVCmDzq6J17VMjmep3rqzXvWwGte2EHh69adI9Vr/A4yeXceE9jRENF9CF2U4H/DeSWKHbDZdPTjC05SSv30hlaA40/awAS4kUtyeZkZri2KIQJO5Wl7XUq9Qf3oy1OrUZRWmAOI5zv9lT3jMjDW1b1a6XJOzmsN88Rs)
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 68 bytes
```
$p=$args
&($t={$p|sort-object{"`$p=`$args
&(`$t={$t})$_"|% i*f $_}})
```
[Try it online!](https://tio.run/##NY7HVsMwFET3@oqHeLbikNA7mJhO6CV0iEtwYgcHG0sQQBa/bnTgsJjFnbmLydJhmPMoTJISA1uWmNno5z1OzAoKW2JW8DQX9TTohx0hqad371/wfg2hLHRpYUBc7QK6SlmlIqzJIRbgQyvkosFqumBsoHkY@X@s4zDiTU3PzM7NLywuTdbt7xFnFI22Wa1Y7tir/iU@3@I0u388u94@b91eNk9OiVQ@f@r2ov5zssLYw/rF1s7u3v7B4TItvj4678HLoDY@cXezebVxfLS61iDMgYIYIAkA5mCDCRiA42qkDHNGiSp/AA)
[Answer]
# [Python 2](https://docs.python.org/2/), 62 bytes
```
lambda a:sorted(a,key=('lambd :sorted(,ky=\'\\+).fin'+a).find)
```
Same concept as my C# answer.
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHRqji/qCQ1RSNRJzu10lZDHSyuABPVya60jVGPidHW1EvLzFPXTgTTKZr/C4oy80oU1NX1svIz8zTSNIoSy@Mz8wpKSzQ0NTX/KygqKauoqqlraGpp6@jq6RsYGhmbmJqZW1haWdvY2tk7ODo5u7i6uXt4enn7@Pr5BwQGBYeEhoVHREZFx8TGxSckJiWnpKalZ2RmZefk5uUXFBYVl5SWlVdUVlXX1NYBAA "Python 2 – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~18~~ 7 bytes
Takes input as an array of characters
```
nQi"nQi
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=blFpIm5RaQ&input=WyduJywnaScsJ1EnLCdpJywnUScsJ24nLCciJ10)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 26 bytes (UTF-8\*)
```
“®³nÞṾ©V”Ṿ©VV
```
[Try it online!](https://tio.run/##y0rNyan8//9Rw5xD6w5tzjs87@HOfYdWhj1qmAthhP3//18dytscdmjnoZ36@iDFK8Oc4h0f7lp4aHnYoZV5QNnD8w6tUwcA "Jelly – Try It Online")
Takes input as a Python-formatted string in the 1st command-line argument.
[Unique characters](https://tio.run/##y0rNyan8/z/w////6o8a5hxad2hz3uF5D3fuO7Qy7FHDXAgjTB0A):
```
“®³nÞṾ©V”
```
\*Note: I discovered that this doesn't work when encoded in JELLY, since it sorts the UTF-8 characters instead of its own bytes.
[Answer]
# [ReRegex](https://github.com/TehFlaminTaco/ReRegex), 335 bytes
```
([^(])\(/($1/([^(])\[/[$1/([^(\[])\^/^$1/([^(\[^])]/]$1/([^(\[^\]])\)/)$1/([^(\[^\])])\\/\\$1/([^(\[^\])\\])\//\/$1/([^(\[^\])\\\/])\$/\$$1/([^(\[^\])\\\/$])1/1$1/([^(\[^\])\\\/$1])\#/\#$1/([^(\[^\])\\\/$1\#])i/i$1/([^(\[^\])\\\/$1\#i])n/n$1/([^(\[^\])\\\/$1\#in])p/p$1/([^(\[^\])\\\/$1\#inp])u/u$1/([^(\[^\])\\\/$1\#inpu])t/t$1/#input
```
A Naïve solution, bubble sorts characters to the left based on their occurance in the source code, which only consists of the characters `([^])\/$1#input` (in order). Unfortunately, it requires a separate regex for each character, which gets progressively longer per index. Seperating the regexes for readability gives:
```
([^(])\(/($1/
([^(])\[/[$1/
([^(\[])\^/^$1/
([^(\[^])]/]$1/
([^(\[^\]])\)/)$1/
([^(\[^\])])\\/\\$1/
([^(\[^\])\\])\//\/$1/
([^(\[^\])\\\/])\$/\$$1/
([^(\[^\])\\\/$])1/1$1/
([^(\[^\])\\\/$1])\#/\#$1/
([^(\[^\])\\\/$1\#])i/i$1/
([^(\[^\])\\\/$1\#i])n/n$1/
([^(\[^\])\\\/$1\#in])p/p$1/
([^(\[^\])\\\/$1\#inp])u/u$1/
([^(\[^\])\\\/$1\#inpu])t/t$1/
#input
```
[Try it online!](https://tio.run/##dYxLCsMwDAWvIogX1qYP36U7S4ZQTJNFk2A7tLdP3VL6S7KwzMwIpZjiOd6WxfpglcXCGocXePgXiK8YEN4YlBX6QdG6wOBvw1UJRH6cPB4g@LOCOg3ErLxRdnBr7erfQJqNIo1yj36z9MoDhu00KE@YdtqkPGPei7NyQan1CWVZjl2fiamOlg5UYi4kIHsdu3F0ZChQHi@RlPLUpkjNqWtTeyoxZfH0vHEH "ReRegex – Try It Online")
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 647 bytes
```
,[>>>+>,]<<<<[<<<<]>>>>[[->+>+<<]--[>-<++++++]>-<+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[[->+>+<<]-[>-<---]>------<+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[[->+>+<<]----[>-<----]>+<+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[[->+>+<<]--[>-<++++++]><+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[[->+>+<<]-[>-<---]>--------<+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[[->+>+<<]----[>-<----]>+++<+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[[->+>+<<]--[>-<++++++]>--<+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[[->+>+<<]--[>-<++++++]>---<+>[<->[-]]<[>>.>-<<<-]>>[-<<+>>]>>]<<<<[<<<<]>>>>[>>>[<<<.>>>-]>]
```
This was a mouthful. For each of Brainfuck's 8 command characters (In order of source appearance), compares them to each character of the input and outputs it when they occur. After each character is done, it outputs whatever wasn't found.
## Ungolfed
```
,[>>>+>,]             Load each character of input with some memory padding
<<<<[<<<<]>>>>         Navigate to the start
[                   For each COMMA
    [->+>+<<]           Copy over the next two
    --[>-<++++++]>-     Subtract 44
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset
[                   For each LEFT BRACKET
    [->+>+<<]           Copy over the next two
    -[>-<---]>------    Subtract 91
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset 
[                   For each RIGHT ANGLE BRACKET
    [->+>+<<]           Copy over the next two
    ----[>-<----]>+     Subtract 62
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset
[                   For each PLUS
    [->+>+<<]           Copy over the next two
    --[>-<++++++]>      Subtract 43
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset
[                   For each RIGHT BRACKET
    [->+>+<<]           Copy over the next two
    -[>-<---]>--------  Subtract 93
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset
[                   For each LEFT ANGLE BRACKET
    [->+>+<<]           Copy over the next two
    ----[>-<----]>+++   Subtract 60
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset
[                   For each MINUS
    [->+>+<<]           Copy over the next two
    --[>-<++++++]>--    Subtract 45
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset
[                   For each DOT
    [->+>+<<]           Copy over the next two
    --[>-<++++++]>---   Subtract 46
    <+>[<->[-]]<[       If NOT Zero
        >>.                 Write it
        >-                  Unset the remember flag
        <<<-                And unset the test flag
    ]
    >>[-<<+>>]          Copy Back
    >>                  Next Char
]<<<<[<<<<]>>>>     And Reset
[       For each remaining character
    >>>[    If the remember flag is still set
        <<<.    Write it
        >>>-    Unset the flag
    ]>      Next character
]       Until it is done
```
[Try it online!](https://tio.run/##rY9LCsMwDESv0r08PoHQRYQW6Y@UmgYCocd3x4FCu@im9oBtaZAenuM63R7X7XSvNbmZiaVQytsVNMwddIUd4AaVXdEqc4U5IpSrmY4quOMsxIzVb1QjAZzGri4W8MZxQ/pQnwlHBhwaUQaG7P3YN@sfWDtsMl8ORq2SkOdLKcvhuazlrObxAg "brainfuck – Try It Online")
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2) `J`, 18 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
"XÞxṘs+nȮ"XÞxṘs+nȮ
```
#### Explanation
```
"XÞxṘs+nȮ"XÞxṘs+nȮ  # Implicit input
"XÞxṘs+nȮ"          # Push the string "XÞxṘs+nȮ"
          X         # Pop and store in the variable x
           Þ        # Sort the input by the following:
            x       #  Push x, "XÞxṘs+nȮ"
             Ṙ      #  Get its representation (surround by quotes)
              s+    #  Append the current character
                nȮ  #  And get its index in this string
                    # Implicit output, joined by the J flag
```
#### Screenshot
[![Screenshot](https://i.stack.imgur.com/1VCyMm.png)](https://i.stack.imgur.com/1VCyM.png)
]