This is the tools section I often use, the new version, actually. No, this doesn't mean the code is good, this just means I've added some functions and fixed core bugs. Here are some notes: (you can resize this div below)
- Tested on firefox 48 and chromium 53, and some features may not work on other browsers, although basic functionality should work.
- Everything here is client-side, and the data you enter here is not sent to me. However, keep in mind that not all files are initially loaded (to save load time), so some files are loaded only after you try to use a particular feature - this request is just for that file, no data is sent.
- These transform functions work on selection, or on the whole text if nothing selected. Regex search and replace doesn't (except highlight & replace & extract all), because that would not make any sense.
- Textarea cannot handle the \r character (this can break newline characters), and sometimes in firefox the \xa0 character gets replaced with \x20. That's why this textarea uses an internal buffer to store the real value so that you can operate on binary data. HOWEVER, any manual change you make to the textarea will actually modify these characters! When these characters are present, it says "binary mode" below the textarea, otherwise it says "text mode". You can copy binary data because the copy event is intercepted, however pasting binary data doesn't work in firefox.
- You can drag files into the textarea! They will be interpreted as binary, so if you want Unicode, then press UTF8 decode. Dragging files out of the browser is not supported, but you can download the content, via clicking Download - or right clicking it and pressing "save as"
- You can use Ctrl+R to redo last used transform function (works on selection too).
- After you use a transform, that transform becomes the "marked" one (so that you can use it per element in 1D/2D array). To mark a transform without applying it, hold the button for more than one second (the button should become blue).
- Shared copy/paste does not affect your system clipboard - it's a feature that let's you transfer binary data (with \r characters) between instances of this page (per browser, uses local storage).
- Extract all means replace all and remove everything that wasn't replaced.
- By quote escape character I mean CSV quotes. The whole element/row concept was initially designed to handle CSV data.
- Hexify simply replaces non-printable characters with their hex representation in brakcets, so for instance null byte becomes [00]. (and obviously, stuff in brackets is escaped so that the operation is reversible)
- Extend regex transforms a given non-extended regex to the "extended" form (as seen in PCRE), which means it escapes spaces and #, and then it formats the regex so that it's easier to read, and also contains comments with group numbers (and that even supports nested ?|!)
- Reformat regex assumes that the regex is already in the extended form, whereas Extend regex assumes the opposite.
- Regex replacement string is like in JS but with additional features: ${num}, ${name}, and conditionals: ${pat?matched} and ${pat!didntmatch}, they test whether the pattern given a by number or name is active (empty still means active, use the | character before ? or ! to change this). Conditionals can be nested.
- Support for other regex engines is experimental, as those were not written in JS, but compiled using emscripten. There are some additional notes:
- in PCRE non-multiline mode, $ behaves like in JS - matches the real end of the string, not trailing newline
- in Ruby syntax [^] can be used to match everything, presence of named groups does not mean numbered groups are inactive, and in singleline mode $ is the end of string even if the string ends with a newline (to match JS behaviour)
- in Ruby syntax, when a patterns needs to match exactly X characters, this may be considered one step
- in Ruby syntax, {n,m}+ doesnt work like in Java, you need to use (?>(?>pattern){n,m}+), which at least for me was not what I thought when I typed {n,m}+
- there are new features that aren't present in Ruby, namely relative regex and RegExtractor - these are explained below:
Relative regex
If you type + after the opening parenthesis of your capturing group, this group will act as the root of that regex, which means it will act as if that group was the entire match. Groups aren't renumbered (but $& is affected), so groups outside roots are still accessible. It starts to make sense only when used with loops or recursion, because all matches of a group marked as root are returned, even if this group is inside recursion!
Of course a group marked as root can't be recurse to itself. Just like one root group may not be contained in another root group.For example, using regex ^a(cb(+c)+dc)*e$, and the replacement string [$&], if the string is acbcdccbccdccbcccdce, replace all will produce the following result: acb[c]dccb[c][c]dccb[c][c][c]dce. That is, it will only match those c inside, but it will match all of them.
There is one major difference: in case of recursion, $n in the replacement string will only be affected by captures on the same level of recursion (just like in PCRE). Groups outside roots are accessible, but only the "closest instance" is returned (same level of recursion, same loop iteration etc).
RegExtractor
RegExtractor lets you extract specified capturing groups in the regex as a JSON tree. All occurences of marked matches will be captured. Loops are turned into arrays. Recursion is supported too. IOW, every marked group that was matched by a given regex will be present in the resulting JSON tree.
In order to mark groups, append approporiate sequences below after the opening parenthesis of the group you'd want to affect (or at the begining of the regex in case of *u:):
+ - mark group as included, without any options
or you can use the following:*c: - add .content (forces object, doesn't work on headers)
*o: - force object (without content)
*a: - force array. in most cases, this is automatically added when a quantifier is detected so it's only needed for duplicate named groups and quantifiers on subexp calls
*n: - never create arrays - store only the last result
*u: - if we have only one key, unpack it (you can specify this on root too)
*j: - if it's an array of strings, join them*h: - this is a header
header options:
*m: - if only one group is there other than header, dont "unpack" it
*d: - always put keys in array even if no duplicates
*n: - never put keys in array, remember only last key
Example: abc(+def)+ghi(*n:?
jkl)+
- Binary pack tool uses syntax from bufferpack, extended by: ? is a boolean, qQ are signed and unsigned long long respectively (stored as an array of [lowBits, highBits] due to JS and therefore JSON limitation), and you can use a - suffix to denote that this item is not stored, but contains the length of the next A or s item.
- JSONPath syntax is described here, this is an extended version of the original syntax.
This project uses the following third-party libraries: Pako, esrever, DMP, PCRE, Onigmo, bufferpack, jsonpath-plus, jsonxml (heavily modified) and vkbeautify. Non JS code was compiled to JS via emscripten. Thx open source community :)
Text-op:Base64 UTF-8 Hex Wide hex Octal URL hex data hex data Base JSON Regex non-printable chars HTML C literal () Lax UTF8 as , encode extra bytes: Select times! Extract from hex dump JSON array indent globally that indent on each level regex (read info!) generic nested structformed by , separated bywith strings indented with , not breaking items not longer than and with max nesting level slice (, ) characters whose position mod is decimal number precision to Unicode maps:
Unicode combining characters: Unicode normalization: Unicode tricks: Beautify: , with indent:
with indent above
=>
, input is (for HTML; may break XML)
Binary pack tool:
Bytes I/O: Format (JSPack): Length in bytes: 33 |
occurences of : 0
Download
with/as
Regex examples:
Press 'Next' to start matching. Match found @ position , match length: , steps: 0
| More examples/tools: |
columns to columns from additional textarea at column | Element/column separator: Row separator: Quote escape character:
Apply marked transform to: | ||
| |||
elements
elements with , to length Set of elements here with elements in additional textarea
|
with
+ Show additional textarea- Hide additional textarea
Color converter:
This requires modern browsers (FF and chrome). All fields are editable, and you can also click on the preview box to open the system color picker. Note that non RGB values are not rounded, even if it would produce the same RGB value, that's on purpose.
Mode:
|
Hex: | RGB: | HSV: | HSL: |
JS Expression Evaluator:
Expression: |
XOR brute tool: (input = selection from textop)
best edit distances for key lengths from to
Key mode:
Key length | Distance |
Modulo Calculator: (uses native ints, for numbers less than 252 only, and some functions are brute-force, sorry...)
Modulus: (0 = off)
|
Modulo independent: |
Result: | |
Chinese Remainder calculator:
Number base converter:
Number base: (or "IP")
Number:
Permutations tool:
Map form:
Cyclic form:
A: | B: | |
Result:
Link generator:
Hamming distance (binary):
Mode:
of length
of length
into to sets
Starting from:
Skip first items
Max items to generate:
Items generated: 0