#Redjay writes
Explore tagged Tumblr posts
Text
He's Here (short story)
“He’s finally here! Did you meet him yet?”
“....”
“I know you can hear me, silly herb. You know it’s rude not to answer a cat’s questions.”
“...I met him.” Gorsedaisy suppressed a shiver, recalling the vision of blood and screams. She screwed her eyes so tight that it gave her a headache that stretched to her ears, flattened against her skull as the echoing cries drummed through them.
“Isn’t he just the darling-est thing you’ve ever seen? Oh, he looks just like my Redjay!” Gorsedaisy flinched at the mention of that name. She worked her claws in and out of her nest, shredded so often that it could hardly be called a place to rest.
She kept her gaze fixed on the fern-packed wall of the den, but she could still hear Bella-May trot around her like an excited kit–or like a cat toying with their prey. “Don’t forget the dead ones,” she murmured.
These Dark Forest fleas haunted Gorsedaisy almost every second of every day. She would take any hit at them that she could take, even if it was to mention the death of such young kin. Gorsedaisy felt terrible for the little ones, she wasn’t heartless! But feeling bad for a death didn’t mean she couldn’t use it to slash at someone’s high.
Bella-May’s voice dropped. “Yes, poor little stars. Blacksong doesn’t deserve such grief. Poor girl’s had a rough life.”
“With you as her kin, I imagine.”
There was a scrape of claws against stone. “Careful, sweetheart. An attitude like that could get you killed.”
Gorsedaisy’s heart leaped into her throat. Stars..moons..years–she didn’t know how long it had been–of being threatened and laughed at and mocked by ghosts that tortured her in life. She had thought that perhaps one day, if it continued then maybe she would at least get used to it. Could ignore them as though their words were merely whispers in the wind. But her stomach pressed hard against her lungs stronger than ever, driving the wind out of her as she struggled for breath. Her head was light. Dizzy.
Bella-May softened. “Oh, I can’t be mad for long! Not on a day as grand as this one! My first great-grandkit, here at last! And the vision! He is going to be a force the Clans won’t soon forget.”
Gorsedaisy shook her head.
No.
Why?
This couldn’t be happening, it had to be fake. A trick. A Joke. Weren’t ghosts enough? Wasn’t the past never leaving her memory enough? Weren’t nightmares every night enough? What could she do to stop what was to come? Kill a kit? The very thought made her want to throw up. What did StarClan expect her to do, then, wait for her Clanmates to drop dead around her? Why send the vision at all? Could StarClan really be so cruel as to let another of those horrendous cats live and plague her home?
================
--Just wanted to write Bella excited about Myrtlekit's birth, so here she is rubbing it in Gorsedaisy's face.
--@ambitiousauthor
#dark tales#dark forest tales#wc dark tales#gorsedaisy#gorsedaisy story#bella-may#bella-may story#myrtlewing#wooden teeth family#eye-out family#myrtlekit#redjay#blacksong
2 notes
·
View notes
Text
What Brings Him Back
Me: Okay, time to do some warm ups. Let’s keep it simple. Describe a field. That should be easy enough.
My brain: Make it Klance
Keith had learned a lot from his time traveling the universe. He had seen many things, met many people, and discovered many secrets that the universe had kept hidden away. They weren’t big secrets. Nothing universe shattering. Rather, small secrets. Inconsequential.
Secrets like the great mountain of Icamon, rumored to be the largest mountain in the Plaxium system, was actually no bigger than one of the sand dunes he used to climb during his time out in the desert. The people of the Plaxium system just turned out to be very small.
Secrets like the reason for the sweet scent of the Borunia, inhabitants of the planet Boruna. Although they were considered to be a vile, arrogant people, they were famous for their consistent smell of what Keith could only describe as the purest vanilla. In actuality, it wasn’t a natural scent at all. Instead, the smell came from the leaves of a plant they used to make their favorite dish. The Borunia had a strange ability to secrete scents of what they ingest, giving them their vanilla aroma.
Secrets like how no matter where he went, Keith only ever found one place he wanted to return to. It was a place that was always in his thoughts. He could be thousands of light years away and still the yearn to see grassy fields and clear blue skies would pull him back to Earth. It was like some tether was constantly tugging at his being, telling him to come home; telling him that something was waiting for him.
And so he would return. Always to the same place. A place where summer days were welcoming and winter nights were serene. A place that was ever-changing but remained the same. A place where the wind blew strong enough to lift the hair from his face, but not so strong as to disturb the peace; like the whole planet was sighing. A place where pinks, purples, and yellows danced among a sea of green, a kaleidoscope of colors that moved and swayed as if compelled by some beat Keith couldn’t hear.
He didn’t know why it was here he needed to return to. He didn’t know what was waiting for him. And each time he left, he felt like a part of him was staying behind to slumber amongst the flowers.
“Back again?” A voice said, light and airy. “It’s only been four months since your last visit.”
Keith looked over his shoulder, indigo eyes meeting deep blue ones. “Feels like a lot longer.”
Lance gave a crooked half-smile, wading through the grass for a few steps until he was standing next to Keith. He clasped both hands behind his back, rocking forward on his feet slightly. His gaze had turned outwards, eyes surveying the field with a sort of admiration that Keith couldn’t quite understand.
“She would be proud of you.” Keith said, finding that the words almost seemed to get stuck in his throat. They felt wrong. Like they didn’t belong in this place.
Out of the corner of his eye, he could see Lance shaking his head, eyes shining brightly in the summer sun. “I don’t do this for her. At least not anymore.” Lance’s voice was still light, but there was a heaviness to his words. Not from sorrow. Not from regret. But rather a weight that carried an importance with it.
Keith found himself scrunching his face in confusion. “What? Why not?”
Lance gave a small shrug. “Found someone else to do it for.” He paused for a moment, blue eyes shifting to Keith. “Someone who can’t quite seem to stay away.”
Keith met his gaze, but said nothing. It seemed like Lance still had more to say.
“I can’t do space anymore. It’s...too big. The price out there is too high. I don’t want to pay it. Not again.” Lance let out a tired sigh, the lazy smile never leaving his face. “But growing something that will remind you of that price? Remind you of what there is to lose? It might sound silly, but it makes me feel like in some small way...I’m keeping you safe.”
Silence fell between the two, the wind seeming to pick up as it did. It tousled his hair, black strands being pulled back from his face, allowing him to see more clearly than he ever had before. And how blind he had been.
It had never been the field pulling him back to Earth. Not even once. Rather it had been tan skin and ocean blue eyes. It had been messy brown hair and soft, musical laughter. It had been the worry when he was gone and the relief when he came back.
And for as smart as Keith was, for all of the secrets he knew about the universe, he could hardly believe that one this massive had remained hidden from him for so long. He wanted to kick himself. He wanted to laugh at how stupid he had been. He wanted to grab his past self by the shoulders and shake some sense into him.
But he didn’t do any of those things. Instead, he just said,
“I don’t think that’s silly at all.”
#Klance#voltron#vld#keith kogane#lance mcclain#just something short and sweet for ya to chew on#enjoy#Redjay Writes
41 notes
·
View notes
Text
New JavaScript Features That Will Change How You Write Regex
New JavaScript Features That Will Change How You Write Regex
Faraz Kelhini
2019-02-08T13:00:32+01:002019-02-08T12:33:17+00:00
There’s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished with a single line of regular expression code. While the built-in functions in most languages are usually sufficient to perform search and replace operations on strings, more complex operations — such as validating text inputs — often require the use of regular expressions.
Regular expressions have been part of the JavaScript language since the third edition of the ECMAScript standard, which was introduced in 1999. ECMAScript 2018 (or ES2018 for short) is the ninth edition of the standard and further improves the text processing capability of JavaScript by introducing four new features:
Lookbehind assertions
Named capture groups
s (dotAll) Flag
Unicode property escapes
These new features are explained in detail in the subsections that follow.
Debugging JavaScript
console.log can tell you a lot about your app, but it can't truly debug your code. For that, you need a full-fledged JavaScript debugger. Read more →
Web forms are such an important part of the web, but we design them poorly all the time. The brand-new “Form Design Patterns” book is our new practical guide for people who design, prototype and build all sorts of forms for digital services, products and websites. The eBook is free for Smashing Members.
Check the table of contents ↬
Lookbehind Assertions
The ability to match a sequence of characters based on what follows or precedes it enables you to discard potentially undesired matches. This is especially important when you need to process a large string and the chance of undesired matches is high. Fortunately, most regular expression flavors provide the lookbehind and lookahead assertions for this purpose.
Prior to ES2018, only lookahead assertions were available in JavaScript. A lookahead allows you to assert that a pattern is immediately followed by another pattern.
There are two versions of lookahead assertions: positive and negative. The syntax for a positive lookahead is (?=...). For example, the regex /Item(?= 10)/ matches Item only when it is followed, with an intervening space, by number 10:
const re = /Item(?= 10)/; console.log(re.exec('Item')); // → null console.log(re.exec('Item5')); // → null console.log(re.exec('Item 5')); // → null console.log(re.exec('Item 10')); // → ["Item", index: 0, input: "Item 10", groups: undefined]
This code uses the exec() method to search for a match in a string. If a match is found, exec() returns an array whose first element is the matched string. The index property of the array holds the index of the matched string, and the input property holds the entire string that the search performed on. Finally, if named capture groups are used in the regular expression, they are placed on the groups property. In this case, groups has a value of undefined because there is no named capture group.
The construct for a negative lookahead is (?!...). A negative lookahead asserts that a pattern is not followed by a specific pattern. For example, the pattern /Red(?!head)/ matches Red only if it not followed by head:
const re = /Red(?!head)/; console.log(re.exec('Redhead')); // → null console.log(re.exec('Redberry')); // → ["Red", index: 0, input: "Redberry", groups: undefined] console.log(re.exec('Redjay')); // → ["Red", index: 0, input: "Redjay", groups: undefined] console.log(re.exec('Red')); // → ["Red", index: 0, input: "Red", groups: undefined]
ES2018 complements lookahead assertions by bringing lookbehind assertions to JavaScript. Denoted by (?<=...), a lookbehind assertion allows you to match a pattern only if it is preceded by another pattern.
Let’s suppose you need to retrieve the price of a product in euro without capturing the euro symbol. With a lookbehind, this task becomes a lot simpler:
const re = /(?<=€)\d+(\.\d*)?/; console.log(re.exec('199')); // → null console.log(re.exec('$199')); // → null console.log(re.exec('€199')); // → ["199", undefined, index: 1, input: "€199", groups: undefined]
Note: Lookahead and lookbehind assertions are often referred to as “lookarounds”.
The negative version of lookbehind is denoted by (?<!...) and enables you to match a pattern that is not preceded by the pattern specified within the lookbehind. For example, the regular expression /(?<!\d{3}) meters/ matches the word “meters” if three digits do not come before it:
const re = /(?<!\d{3}) meters/; console.log(re.exec('10 meters')); // → [" meters", index: 2, input: "10 meters", groups: undefined] console.log(re.exec('100 meters')); // → null
As with lookaheads, you can use several lookbehinds (negative or positive) in succession to create a more complex pattern. Here’s an example:
const re = /(?<=\d{2})(?<!35) meters/; console.log(re.exec('35 meters')); // → null console.log(re.exec('meters')); // → null console.log(re.exec('4 meters')); // → null console.log(re.exec('14 meters')); // → ["meters", index: 2, input: "14 meters", groups: undefined]
This regex matches a string containing meters only if it is immediately preceded by any two digits other than 35. The positive lookbehind ensures that the pattern is preceded by two digits, and then the negative lookbehind ensures that the digits are not 35.
Named Capture Groups
You can group a part of a regular expression by encapsulating the characters in parentheses. This allows you to restrict alternation to a part of the pattern or apply a quantifier on the whole group. Furthermore, you can extract the matched value by parentheses for further processing.
The following code gives an example of how to find a file name with .jpg extension in a string and then extract the file name:
const re = /(\w+)\.jpg/; const str = 'File name: cat.jpg'; const match = re.exec(str); const fileName = match[1]; // The second element in the resulting array holds the portion of the string that parentheses matched console.log(match); // → ["cat.jpg", "cat", index: 11, input: "File name: cat.jpg", groups: undefined] console.log(fileName); // → cat
In more complex patterns, referencing a group using a number just makes the already cryptic regular expression syntax more confusing. For example, suppose you want to match a date. Since the position of day and month is swapped in some regions, it’s not clear which group refers to the month and which group refers to the day:
const re = /(\d{4})-(\d{2})-(\d{2})/; const match = re.exec('2020-03-04'); console.log(match[0]); // → 2020-03-04 console.log(match[1]); // → 2020 console.log(match[2]); // → 03 console.log(match[3]); // → 04
ES2018’s solution to this problem is named capture groups, which use a more expressive syntax in the form of (?<name>...):
const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2020-03-04'); console.log(match.groups); // → {year: "2020", month: "03", day: "04"} console.log(match.groups.year); // → 2020 console.log(match.groups.month); // → 03 console.log(match.groups.day); // → 04
Because the resulting object may contain a property with the same name as a named group, all named groups are defined under a separate object called groups.
A similar construct exists in many new and traditional programming languages. Python, for example, uses the (?P<name>) syntax for named groups. Not surprisingly, Perl supports named groups with syntax identical to JavaScript (JavaScript has imitated its regular expression syntax from Perl). Java also uses the same syntax as Perl.
In addition to being able to access a named group through the groups object, you can access a group using a numbered reference — similar to a regular capture group:
const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2020-03-04'); console.log(match[0]); // → 2020-03-04 console.log(match[1]); // → 2020 console.log(match[2]); // → 03 console.log(match[3]); // → 04
The new syntax also works well with destructuring assignment:
const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const [match, year, month, day] = re.exec('2020-03-04'); console.log(match); // → 2020-03-04 console.log(year); // → 2020 console.log(month); // → 03 console.log(day); // → 04
The groups object is always created, even if no named group exists in a regular expression:
const re = /\d+/; const match = re.exec('123'); console.log('groups' in match); // → true
If an optional named group does not participate in the match, the groups object will still have a property for that named group but the property will have a value of undefined:
const re = /\d+(?<ordinal>st|nd|rd|th)?/; let match = re.exec('2nd'); console.log('ordinal' in match.groups); // → true console.log(match.groups.ordinal); // → nd match = re.exec('2'); console.log('ordinal' in match.groups); // → true console.log(match.groups.ordinal); // → undefined
You can refer to a regular captured group later in the pattern with a backreference in the form of \1. For example, the following code uses a capture group that matches two letters in a row, then recalls it later in the pattern:
console.log(/(\w\w)\1/.test('abab')); // → true // if the last two letters are not the same // as the first two, the match will fail console.log(/(\w\w)\1/.test('abcd')); // → false
To recall a named capture group later in the pattern, you can use the /\k<name>/ syntax. Here is an example:
const re = /\b(?<dup>\w+)\s+\k<dup>\b/; const match = re.exec("I'm not lazy, I'm on on energy saving mode"); console.log(match.index); // → 18 console.log(match[0]); // → on on
This regular expression finds consecutive duplicate words in a sentence. If you prefer, you can also recall a named capture group using a numbered back reference:
const re = /\b(?<dup>\w+)\s+\1\b/; const match = re.exec("I'm not lazy, I'm on on energy saving mode"); console.log(match.index); // → 18 console.log(match[0]); // → on on
It’s also possible to use a numbered back reference and a named backreference at the same time:
const re = /(?<digit>\d):\1:\k<digit>/; const match = re.exec('5:5:5'); console.log(match[0]); // → 5:5:5
Similar to numbered capture groups, named capture groups can be inserted into the replacement value of the replace() method. To do that, you will need to use the $<name> construct. For example:
const str = 'War & Peace'; console.log(str.replace(/(War) & (Peace)/, '$2 & $1')); // → Peace & War console.log(str.replace(/(?<War>War) & (?<Peace>Peace)/, '$<Peace> & $<War>')); // → Peace & War
If you want to use a function to perform the replacement, you can reference the named groups the same way you would reference numbered groups. The value of the first capture group will be available as the second argument to the function, and the value of the second capture group will be available as the third argument:
const str = 'War & Peace'; const result = str.replace(/(?<War>War) & (?<Peace>Peace)/, function(match, group1, group2, offset, string) { return group2 + ' & ' + group1; }); console.log(result); // → Peace & War
s (dotAll) Flag
By default, the dot (.) metacharacter in a regex pattern matches any character with the exception of line break characters, including line feed (\n) and carriage return (\r):
console.log(/./.test('\n')); // → false console.log(/./.test('\r')); // → false
Despite this shortcoming, JavaScript developers could still match all characters by using two opposite shorthand character classes like [\w\W], which instructs the regex engine to match a character that’s a word character (\w) or a non-word character (\W):
console.log(/[\w\W]/.test('\n')); // → true console.log(/[\w\W]/.test('\r')); // → true
ES2018 aims to fix this problem by introducing the s (dotAll) flag. When this flag is set, it changes the behavior of the dot (.) metacharacter to match line break characters as well:
console.log(/./s.test('\n')); // → true console.log(/./s.test('\r')); // → true
The s flag can be used on per-regex basis and thus does not break existing patterns that rely on the old behavior of the dot metacharacter. Besides JavaScript, the s flag is available in a number of other languages such as Perl and PHP.
Recommended reading: An Abridged Cartoon Introduction To WebAssembly
Unicode Property Escapes
Among the new features introduced in ES2015 was Unicode awareness. However, shorthand character classes were still unable to match Unicode characters, even if the u flag was set.
Consider the following example:
const str = '𝟠'; console.log(/\d/.test(str)); // → false console.log(/\d/u.test(str)); // → false
𝟠 is considered a digit, but \d can only match ASCII [0-9], so the test() method returns false. Because changing the behavior of shorthand character classes would break existing regular expression patterns, it was decided to introduce a new type of escape sequence.
In ES2018, Unicode property escapes, denoted by \p{...}, are available in regular expressions when the u flag is set. Now to match any Unicode number, you can simply use \p{Number}, as shown below:
const str = '𝟠'; console.log(/\p{Number}/u.test(str)); // → true
And to match any Unicode alphabetic character, you can use \p{Alphabetic}:
const str = '漢'; console.log(/\p{Alphabetic}/u.test(str)); // → true // the \w shorthand cannot match 漢 console.log(/\w/u.test(str)); // → false
\P{...} is the negated version of \p{...} and matches any character that \p{...} does not:
console.log(/\P{Number}/u.test('𝟠')); // → false console.log(/\P{Number}/u.test('漢')); // → true console.log(/\P{Alphabetic}/u.test('𝟠')); // → true console.log(/\P{Alphabetic}/u.test('漢')); // → false
A full list of supported properties is available on the current specification proposal.
Note that using an unsupported property causes a SyntaxError:
console.log(/\p{undefined}/u.test('漢')); // → SyntaxError
Compatibility Table
Desktop Browsers
Chrome Firefox Safari Edge Lookbehind Assertions 62 X X X Named Capture Groups 64 X 11.1 X s (dotAll) Flag 62 X 11.1 X Unicode Property Escapes 64 X 11.1 X
Mobile Browsers
ChromeFor Android FirefoxFor Android iOS Safari Edge Mobile Samsung Internet Android Webview Lookbehind Assertions 62 X X X 8.2 62 Named Capture Groups 64 X 11.3 X X 64 s (dotAll) Flag 62 X 11.3 X 8.2 62 Unicode Property Escapes 64 X 11.3 X X 64
Node.js
8.3.0 (requires --harmony runtime flag)
8.10.0 (support for s (dotAll) flag and lookbehind assertions)
10.0.0 (full support)
Wrapping Up
ES2018 continues the work of previous editions of ECMAScript by making regular expressions more useful. New features include lookbehind assertion, named capture groups, s (dotAll) flag, and Unicode property escapes. Lookbehind assertion allows you to match a pattern only if it is preceded by another pattern. Named capture groups use a more expressive syntax compared to regular capture groups. The s (dotAll) flag changes the behavior of the dot (.) metacharacter to match line break characters. Finally, Unicode property escapes provide a new type of escape sequence in regular expressions.
When building complicated patterns, it’s often helpful to use a regular-expressions tester. A good tester provides an interface to test a regular expression against a string and displays every step taken by the engine, which can be especially useful when trying to understand patterns written by others. It can also detect syntax errors that may occur within your regex pattern. Regex101 and RegexBuddy are two popular regex testers worth checking out.
Do you have some other tools to recommend? Share them in the comments!
(dm, il)
0 notes
Text
New JavaScript Features That Will Change How You Write Regex
New JavaScript Features That Will Change How You Write Regex
Faraz Kelhini
2019-02-08T13:00:32+01:002019-02-08T12:17:32+00:00
There’s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished with a single line of regular expression code. While the built-in functions in most languages are usually sufficient to perform search and replace operations on strings, more complex operations — such as validating text inputs — often require the use of regular expressions.
Regular expressions have been part of the JavaScript language since the third edition of the ECMAScript standard, which was introduced in 1999. ECMAScript 2018 (or ES2018 for short) is the ninth edition of the standard and further improves the text processing capability of JavaScript by introducing four new features:
Lookbehind assertions
Named capture groups
s (dotAll) Flag
Unicode property escapes
These new features are explained in detail in the subsections that follow.
Debugging JavaScript
console.log can tell you a lot about your app, but it can't truly debug your code. For that, you need a full-fledged JavaScript debugger. Read more →
Web forms are such an important part of the web, but we design them poorly all the time. The brand-new “Form Design Patterns” book is our new practical guide for people who design, prototype and build all sorts of forms for digital services, products and websites. The eBook is free for Smashing Members.
Check the table of contents ↬
Lookbehind Assertions
The ability to match a sequence of characters based on what follows or precedes it enables you to discard potentially undesired matches. This is especially important when you need to process a large string and the chance of undesired matches is high. Fortunately, most regular expression flavors provide the lookbehind and lookahead assertions for this purpose.
Prior to ES2018, only lookahead assertions were available in JavaScript. A lookahead allows you to assert that a pattern is immediately followed by another pattern.
There are two versions of lookahead assertions: positive and negative. The syntax for a positive lookahead is (?=...). For example, the regex /Item(?= 10)/ matches Item only when it is followed, with an intervening space, by number 10:
const re = /Item(?= 10)/; console.log(re.exec('Item')); // → null console.log(re.exec('Item5')); // → null console.log(re.exec('Item 5')); // → null console.log(re.exec('Item 10')); // → ["Item", index: 0, input: "Item 10", groups: undefined]
This code uses the exec() method to search for a match in a string. If a match is found, exec() returns an array whose first element is the matched string. The index property of the array holds the index of the matched string, and the input property holds the entire string that the search performed on. Finally, if named capture groups are used in the regular expression, they are placed on the groups property. In this case, groups has a value of undefined because there is no named capture group.
The construct for a negative lookahead is (?!...). A negative lookahead asserts that a pattern is not followed by a specific pattern. For example, the pattern /Red(?!head)/ matches Red only if it not followed by head:
const re = /Red(?!head)/; console.log(re.exec('Redhead')); // → null console.log(re.exec('Redberry')); // → ["Red", index: 0, input: "Redberry", groups: undefined] console.log(re.exec('Redjay')); // → ["Red", index: 0, input: "Redjay", groups: undefined] console.log(re.exec('Red')); // → ["Red", index: 0, input: "Red", groups: undefined]
ES2018 complements lookahead assertions by bringing lookbehind assertions to JavaScript. Denoted by (?<=...), a lookbehind assertion allows you to match a pattern only if it is preceded by another pattern.
Let’s suppose you need to retrieve the price of a product in euro without capturing the euro symbol. With a lookbehind, this task becomes a lot simpler:
const re = /(?<=€)\d+(\.\d*)?/; console.log(re.exec('199')); // → null console.log(re.exec('$199')); // → null console.log(re.exec('€199')); // → ["199", undefined, index: 1, input: "€199", groups: undefined]
Note: Lookahead and lookbehind assertions are often referred to as “lookarounds”.
The negative version of lookbehind is denoted by (?<!...) and enables you to match a pattern that is not preceded by the pattern specified within the lookbehind. For example, the regular expression /(?<!\d{3}) meters/ matches the word “meters” if three digits do not come before it:
const re = /(?<!\d{3}) meters/; console.log(re.exec('10 meters')); // → [" meters", index: 2, input: "10 meters", groups: undefined] console.log(re.exec('100 meters')); // → null
As with lookaheads, you can use several lookbehinds (negative or positive) in succession to create a more complex pattern. Here’s an example:
const re = /(?<=\d{2})(?<!35) meters/; console.log(re.exec('35 meters')); // → null console.log(re.exec('meters')); // → null console.log(re.exec('4 meters')); // → null console.log(re.exec('14 meters')); // → ["meters", index: 2, input: "14 meters", groups: undefined]
This regex matches a string containing meters only if it is immediately preceded by any two digits other than 35. The positive lookbehind ensures that the pattern is preceded by two digits, and then the negative lookbehind ensures that the digits are not 35.
Named Capture Groups
You can group a part of a regular expression by encapsulating the characters in parentheses. This allows you to restrict alternation to a part of the pattern or apply a quantifier on the whole group. Furthermore, you can extract the matched value by parentheses for further processing.
The following code gives an example of how to find a file name with .jpg extension in a string and then extract the file name:
const re = /(\w+)\.jpg/; const str = 'File name: cat.jpg'; const match = re.exec(str); const fileName = match[1]; // The second element in the resulting array holds the portion of the string that parentheses matched console.log(match); // → ["cat.jpg", "cat", index: 11, input: "File name: cat.jpg", groups: undefined] console.log(fileName); // → cat
In more complex patterns, referencing a group using a number just makes the already cryptic regular expression syntax more confusing. For example, suppose you want to match a date. Since the position of day and month is swapped in some regions, it’s not clear which group refers to the month and which group refers to the day:
const re = /(\d{4})-(\d{2})-(\d{2})/; const match = re.exec('2020-03-04'); console.log(match[0]); // → 2020-03-04 console.log(match[1]); // → 2020 console.log(match[2]); // → 03 console.log(match[3]); // → 04
ES2018’s solution to this problem is named capture groups, which use a more expressive syntax in the form of (?\<name\>...):
const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2020-03-04'); console.log(match.groups); // → {year: "2020", month: "03", day: "04"} console.log(match.groups.year); // → 2020 console.log(match.groups.month); // → 03 console.log(match.groups.day); // → 04
Because the resulting object may contain a property with the same name as a named group, all named groups are defined under a separate object called groups.
A similar construct exists in many new and traditional programming languages. Python, for example, uses the (?P\<name\>) syntax for named groups. Not surprisingly, Perl supports named groups with syntax identical to JavaScript (JavaScript has imitated its regular expression syntax from Perl). Java also uses the same syntax as Perl.
In addition to being able to access a named group through the groups object, you can access a group using a numbered reference — similar to a regular capture group:
const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const match = re.exec('2020-03-04'); console.log(match[0]); // → 2020-03-04 console.log(match[1]); // → 2020 console.log(match[2]); // → 03 console.log(match[3]); // → 04
The new syntax also works well with destructuring assignment:
const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/; const [match, year, month, day] = re.exec('2020-03-04'); console.log(match); // → 2020-03-04 console.log(year); // → 2020 console.log(month); // → 03 console.log(day); // → 04
The groups object is always created, even if no named group exists in a regular expression:
const re = /\d+/; const match = re.exec('123'); console.log('groups' in match); // → true
If an optional named group does not participate in the match, the groups object will still have a property for that named group but the property will have a value of undefined:
const re = /\d+(?<ordinal>st|nd|rd|th)?/; let match = re.exec('2nd'); console.log('ordinal' in match.groups); // → true console.log(match.groups.ordinal); // → nd match = re.exec('2'); console.log('ordinal' in match.groups); // → true console.log(match.groups.ordinal); // → undefined
You can refer to a regular captured group later in the pattern with a backreference in the form of \1. For example, the following code uses a capture group that matches two letters in a row, then recalls it later in the pattern:
console.log(/(\w\w)\1/.test('abab')); // → true // if the last two letters are not the same // as the first two, the match will fail console.log(/(\w\w)\1/.test('abcd')); // → false
To recall a named capture group later in the pattern, you can use the \k\<name\> syntax. Here is an example:
const re = /\b(?<dup>\w+)\s+\k<dup>\b/; const match = re.exec("I'm not lazy, I'm on on energy saving mode"); console.log(match.index); // → 18 console.log(match[0]); // → on on
This regular expression finds consecutive duplicate words in a sentence. If you prefer, you can also recall a named capture group using a numbered back reference:
const re = /\b(?<dup>\w+)\s+\1\b/; const match = re.exec("I'm not lazy, I'm on on energy saving mode"); console.log(match.index); // → 18 console.log(match[0]); // → on on
It’s also possible to use a numbered back reference and a named backreference at the same time:
const re = /(?<digit>\d):\1:\k<digit>/; const match = re.exec('5:5:5'); console.log(match[0]); // → 5:5:5
Similar to numbered capture groups, named capture groups can be inserted into the replacement value of the replace() method. To do that, you will need to use the $<name> construct. For example:
const str = 'War & Peace'; console.log(str.replace(/(War) & (Peace)/, '$2 & $1')); // → Peace & War console.log(str.replace(/(?<War>War) & (?<Peace>Peace)/, '$<Peace> & $<War>')); // → Peace & War
If you want to use a function to perform the replacement, you can reference the named groups the same way you would reference numbered groups. The value of the first capture group will be available as the second argument to the function, and the value of the second capture group will be available as the third argument:
const str = 'War & Peace'; const result = str.replace(/(?<War>War) & (?<Peace>Peace)/, function(match, group1, group2, offset, string) { return group2 + ' & ' + group1; }); console.log(result); // → Peace & War
s (dotAll) Flag
By default, the dot (.) metacharacter in a regex pattern matches any character with the exception of line break characters, including line feed (\n) and carriage return (\r):
console.log(/./.test('\n')); // → false console.log(/./.test('\r')); // → false
Despite this shortcoming, JavaScript developers could still match all characters by using two opposite shorthand character classes like [\w\W], which instructs the regex engine to match a character that’s a word character (\w) or a non-word character (\W):
console.log(/[\w\W]/.test('\n')); // → true console.log(/[\w\W]/.test('\r')); // → true
ES2018 aims to fix this problem by introducing the s (dotAll) flag. When this flag is set, it changes the behavior of the dot (.) metacharacter to match line break characters as well:
console.log(/./s.test('\n')); // → true console.log(/./s.test('\r')); // → true
The s flag can be used on per-regex basis and thus does not break existing patterns that rely on the old behavior of the dot metacharacter. Besides JavaScript, the s flag is available in a number of other languages such as Perl and PHP.
Recommended reading: An Abridged Cartoon Introduction To WebAssembly
Unicode Property Escapes
Among the new features introduced in ES2015 was Unicode awareness. However, shorthand character classes were still unable to match Unicode characters, even if the u flag was set.
Consider the following example:
const str = '𝟠'; console.log(/\d/.test(str)); // → false console.log(/\d/u.test(str)); // → false
𝟠 is considered a digit, but \d can only match ASCII [0-9], so the test() method returns false. Because changing the behavior of shorthand character classes would break existing regular expression patterns, it was decided to introduce a new type of escape sequence.
In ES2018, Unicode property escapes, denoted by \p{...}, are available in regular expressions when the u flag is set. Now to match any Unicode number, you can simply use \p{Number}, as shown below:
const str = '𝟠'; console.log(/\p{Number}/u.test(str)); // → true
And to match any Unicode alphabetic character, you can use \p{Alphabetic}:
const str = '漢'; console.log(/\p{Alphabetic}/u.test(str)); // → true // the \w shorthand cannot match 漢 console.log(/\w/u.test(str)); // → false
\P{...} is the negated version of \p{...} and matches any character that \p{...} does not:
console.log(/\P{Number}/u.test('𝟠')); // → false console.log(/\P{Number}/u.test('漢')); // → true console.log(/\P{Alphabetic}/u.test('𝟠')); // → true console.log(/\P{Alphabetic}/u.test('漢')); // → false
A full list of supported properties is available on the current specification proposal.
Note that using an unsupported property causes a SyntaxError:
console.log(/\p{undefined}/u.test('漢')); // → SyntaxError
Compatibility Table
Desktop Browsers
Chrome Firefox Safari Edge Lookbehind Assertions 62 X X X Named Capture Groups 64 X 11.1 X `s` (`dotAll`) Flag 62 X 11.1 X Unicode Property Escapes 64 X 11.1 X
Mobile Browsers
ChromeFor Android FirefoxFor Android iOS Safari Edge Mobile Samsung Internet Android Webview Lookbehind Assertions 62 X X X 8.2 62 Named Capture Groups 64 X 11.3 X X 64 `s` (`dotAll`) Flag 62 X 11.3 X 8.2 62 Unicode Property Escapes 64 X 11.3 X X 64
Node.js
8.3.0 (requires –harmony runtime flag)
8.10.0 (support for s (dotAll) flag and lookbehind assertions)
10.0.0 (full support)
Wrapping Up
ES2018 continues the work of previous editions of ECMAScript by making regular expressions more useful. New features include lookbehind assertion, named capture groups, s (dotAll) flag, and Unicode property escapes. Lookbehind assertion allows you to match a pattern only if it is preceded by another pattern. Named capture groups use a more expressive syntax compared to regular capture groups. The s (dotAll) flag changes the behavior of the dot (.) metacharacter to match line break characters. Finally, Unicode property escapes provide a new type of escape sequence in regular expressions.
When building complicated patterns, it’s often helpful to use a regular-expressions tester. A good tester provides an interface to test a regular expression against a string and displays every step taken by the engine, which can be especially useful when trying to understand patterns written by others. It can also detect syntax errors that may occur within your regex pattern. Regex101 and RegexBuddy are two popular regex testers worth checking out.
Do you have some other tools to recommend? Share them in the comments!
(dm, il)
0 notes
Text
I want to write a story about it but it's still exam seasons and when my mind is focused enough to write, I either focus it toward working on my book or Cliffprance's story so it'll probably be a while
but imagine
Flickerpine hears one of his mates calling for him, maybe for help. He follows the sound only to find Redjay, who only recently discovered that Flickerpine killed some of his kits (when they were elders), and we already know Redjay's history with those who harm his babies
1 note
·
View note
Text
I’ve seen a lot of people doing stuff like this and it looked like fun. So here’s my own little personal Klance epilogue:
Life was supposed to be easier now. The universe was saved. All universes were saved. It was time to rest. But not for Lance.
He tried for awhile. He tried to take life slowly. He tried to live as a simple farmer. He tried to stop thinking about everything he had sacrificed. Everything he lost.
But for Lance, that was easier said than done. There was only so much a simple life could cover up. Only so much that fresh air and open fields could help him forget.
So it was only a matter of time before Lance packed his bags and left. He didn’t know where he was going. He just left in search for his future.
It started with roaming the Earth. Revisiting places he had been. Finding new places.
He met all kinds of strangers. Not as a former paladin. Not as the savior of the universe. But as Lance. Just Lance.
And that was nice for awhile. Talking to people who didn’t know his story. Didn’t know what kind of scars he carried.
But even so, he didn’t find what he was looking for. There was something missing. It was like he was trying to find that last piece to the puzzle, but he didn’t know where to look.
So he left earth. It was easier than he thought.
He worked with a few small time recovery teams, helping those who had suffered in some way, shape, or form.
And although he shouldn’t have been, he was surprised that so many people didn’t know who he was. He supposed it may have to do with no longer sporting his trademark blue and white armor. Or maybe it was the lack of giant robot cat at his side.
Either way, he enjoyed himself. He really did. Visiting new planets? Seeing new cultures? Helping people? It was perfect for him.
Or rather, it should have been perfect.
But again, something was missing. There was an emptiness. A spot next to him that needed filling.
At first, he thought that maybe he was just missing her. And that made sense. The time they spent together was short, but it meant so much to him.
What could he say? He had a habit of throwing himself completely and entirely into something. And if he got hurt in the process...well, he wouldn’t have any regrets then.
And he didn’t have any regrets. The time he spent with her was magical. He would treasure it for the rest of his life.
But he’d be lying if he said it didn’t hurt. It hurt so much. More than anything he’d ever felt before.
But the more he thought about it, the more he realized that is wasn’t her that was missing. He could accept the fact that she was gone. He could come to terms with her sacrifice.
But this? This was something else.
And for a long time Lance didn’t think he would ever figure out what it was. But as with so many things, he was wrong.
It was a coincidence. Lance’s team and his team just happened to be on the same planet. In the same galaxy. In the same sector of the universe. By all rights, it shouldn’t have happened.
But it did. He was there. Pale skin. Black hair. Indigo eyes.
Keith.
He was there...and he was mad.
“Where have you been?! Why didn’t you tell anyone where you were?! Do you know how many people have been worried about you?!”
“I-I’m sorry…I just needed…”
“Needed what?!”
“N-Needed to...get away...from everything.”
And suddenly he wasn’t mad anymore. There was an understanding in his eyes. And in the end, a hand was extended. One that Lance took without hesitation.
He took it. Not because it was Keith. Not because he felt guilty for making people worry. No, he took because for the first time since her, Lance felt complete.
And that was how he joined the Blades. He spent months working to rebuild the universe at Keith’s side.
And Lance found himself not thinking about the bad things. Not wishing that he could go back to the time before Voltron. Before the universe got so big.
Instead, Lance focused on what he could do. What he and Keith could accomplish. Keith filled the empty space she had left.
And as time passed, Lance realized that Keith had become more than just a temporary placeholder. He was more than just a way for Lance to distract himself. He became more than just a former teammate. More than just a work partner. More than just a friend.
He became...well...Lance wasn’t sure. At least, not until that night.
It had become a habit of theirs to sit out at night, watching the stars. It had become a reminder that the universe was huge. A reminder of what they had fought for. A reminder that there were some things that were so much bigger than them.
It was one of those nights. It was just the two of them. It had been a long day. They were both tired. And by all rights, they should be asleep.
But looking at the stars had become important to Lance. It was the part of his day he looked forward to the most. And while Lance always thought that was because he enjoyed the stars, it was this particular night that he realized he had been wrong.
It was Keith. It had always been Keith. It was the only time it was ever just to two of them. And there was something comforting about sharing space with a person who truly knew everything he had gone through. There was no need to explain anything. No trying to make him understand.
There was no pressure to be okay around Keith. And that was something he couldn’t find anywhere else.
So it was on this night that Lance found himself looking at the raven-haired man instead of the sky. He was looking at the his face illuminated by the two moons that hovered above them. He was looking at the soft smile that crested his lips. He was looking at his silky black hair blowing gently in the night breeze. He was looking at his indigo eyes shining in the starlight.
‘Oh.’ Lance thought. ‘I get it. He’s the future. My future.’
Except he didn’t just think it. By some curse or miracle, he said it. Out loud. For Keith to hear.
“Ya know, that’s the second time you’ve called me that. I’m starting to think you actually mean it.”
Lance knew that his face was red. He could tell by the sidelong glance Keith was giving him, slight smirk on his face.
“I-I mean...I just meant...ya know…” Lance was stuttering, words catching in his throat.
Keith chuckled, hand reaching over, fingers lacing gently with his own.
“I think I’m okay with being your future.”
Lance didn’t say anything. He didn’t need to. He just tightened his grip, firmly holding onto the one person that he knew would lead him to the next step and the step after that.
And to him, the future seemed so much brighter than it had ever been before.
#Klance#voltron#vld#season 8 spoilers#lance mcclain#keith kogane#I just want them to be happy#is that too much to ask?#Redjay writes#Redjay headcanon
271 notes
·
View notes
Note
Hello!! I was just wondering, when are you gonna post the next installment to It’s Just Me, You And These Fucking Ghosts? Don’t mean to rush or anything! Sorry if it seems that way!
You’re absolutely fine! No need to apologize. I’m actually in the middle to writing it right now. It’s quite the monster.
But as a gift from me to you, here’s a little taste of what’s to come:
Every inch of his body was frozen. It was like the fear twisting his insides had somehow managed to take control of his very being. All he could do was listen to the thundering pounding of his heart and rapid breathing. His eyes were blown wide, but he wanted nothing more than to shut them. To look away. To pretend that if he just closed his eyes, every scary thing would just go away. But his gaze was glued to the screen, the terror not allowing him a moment’s reprieve.
How had he managed to get roped into this? What had possessed him to agree to something this horrifying? He couldn’t remember. All rational thoughts had ceased, leaving him with nothing but the truth of how truly vulnerable he was. At any moment, something could-
“Ah!” Lance let out a yelp, feeling a hand clamp down on his shoulder. He instinctively jerked away, his fight or flight suddenly kicking into overdrive.
“Dude, chill.” Pidge said, rolling their eyes as they leaned over the back of the couch. “It’s just me.”
“Fucking hell…” Lance said as he let out a long breath, trying unsuccessfully to get his heart rate back to an acceptable speed. “Don’t do that to me!”
“Do what? Ask if you want more popcorn?” Pidge replied sarcastically, but Lance could see the mischievous glint in their eyes.
Lance only glared at them in return.
Pidge laughed and said, “Alright, then. More for me.”
“Aw, c’mon Pidge.” Hunk said from his spot on the recliner next to the couch, gaze following their small friend as they made their way around the couch and sat on the floor in front of where Lance was seated. “He’s barely holding it together as is. Don’t make it worse.”
Lance let out a huff, saying, “I’ll have you know that I’m perfectly fine. This movie isn’t even that scary.” He gestured to the screen where the momentarily forgotten horror flick was still playing.
A snort came from the opposite side of the couch followed by, “Then why are you about to tear the blanket in half?”
Lance glanced down, noticing for the first time his death grip on the blanket that was spread out across his lap. He immediately released his hold, saying, “Shut up, Keith. No one asked you.”
Even in the dark of the room, Lance could see the dangerous look Keith shot at him. He did his best not to flinch and turned his eyes back to the screen.
...That was a mistake. He found himself suddenly thrust back into the nightmare the protagonist had found themselves in. Friends dead. Boyfriend dead. Lost in some forest at night. Hunted by a vengeful ghosty-demony thing. Just about the worst situation imaginable.
I don’t know exactly when I’ll be able to update it but it’s definitely soon
8 notes
·
View notes
Note
do you think you'll ever finish if tomorrow never comes? no pressure, just wondering!
Actually, yes! kinda...let me explain.
So that, with another one of my unfinished stories, I wrote a couple years ago. And right in the middle of writing them I had this massive jump in skill level. I mean, I was taking workshops and getting feedback from writer friends and all that junk. So those stories are very unbalanced, I guess. Like the later stuff is pretty good but the earlier stuff...not so much. And I hated that the story was so lacking in some places because of that and that’s kinda why I just let it sit for so long. I was writing newer stuff that was just so much better.
But all that being said, I really love If Tomorrow Never Comes and Trading Places. Both are stories that I want to finish. So I’m actually doing a complete overhaul of both of them. Complete rewrite. But instead of uploading in chapters, I’ll just do one story dump all at once.
So that being said, here’s a master schedule for my writing projects:
- Forget About Ghosts, Demons are the Fucking Worst pt 2
- Stolen Property - A Critical Role fic that wont be very long (me? writing for a different fandom? It’s more likely than you think!)
- If Tomorrow Never Comes rewrite
- 13 Hours
- Trading Places rewrite
- More Than You Bargained For
That’s the general plan. Keep in mind that I’m also working 40 hrs a week and running my own D&D campaign. But I WILL get to everything on this list. That’s a promise.
4 notes
·
View notes
Text
The Wish
I was doing a little writing warm-up and it kinda got away from me. Whoops. Anyway, here’s a little post S8 Klance thing. I honestly don’t know what it is or where it came from. So...hope you enjoy:
Empty eyes stared without seeing at the rippling clear water in front of him. He was far enough away to not see his reflection, but close enough to observe the way it ebbed and flowed, continuously disturbed by the falling streams that were pumped towards the sky before plunging back down to the surface. The smell of chlorine permeated the air. It wasn’t an unpleasant scent, but rather it seemed out of place compared to the foliage of the rest of the park.
The steady rumble that came from the fountain drowned out all other sounds that should have been present. He couldn’t hear the birds that perched in the few trees situated close by. He couldn’t hear the voices of the people that passed, either on their way to who-knows-where or simply stopping in the park to enjoy the warm autumn afternoon. He couldn’t even hear his own heartbeat which would be strange if not for the relief he found in its absence. He was content with not knowing its pace.
Despite the churning surface of the water, he could see the bottom of the fountain. Bronze and silver specs shifted and swayed to the cadence of the water. He knew they weren’t really moving, but the dance they appeared to be doing helped to steady his mind. He imagined what it would be like to reach in and grab a fistful of the coins. The feeling of damp metal in his palm. The sound of the metallic pieces scraping against each other. The guilt of having stolen the wishes placed so delicately upon each coin.
He would never do that, though. Steal wishes. Not when he himself had deposited so many into the very same fountain he had been standing in front of for the better part of an hour. Instead, he remained still, stuck between wanting to release another wish onto the world and wanting to keep it close to his heart. The only outwardly sign of his indecisiveness was his left hand which trembled, tightening around the small copper coin that he had brought with him.
He could still remember the first wish he had made at this fountain. He could remember the way his nerves twisted up inside him, a foreign type of anxiety eating away at him. He could remember how hard it was to release the coin, to let go and hope that the universe would do the rest. He could remember the regret as he walked away, leaving the coin to rest amongst the others below the surface. He had felt like a failure. Like he couldn’t solve his own problems. He remembered promising himself that he would never go back, that he would never make another wish.
He had lost count of the wishes he had given up to the fountain.
And here he was again, preparing to throw another one away. And while it was always hard...while it always left him with a new hole in his chest, this time it felt like it might rip his whole heart out.
Because this time he wasn’t just letting go of a single wish, he was letting go of a whole person.
It was time. He had known that for awhile. She wasn’t coming back. She was gone. There was no getting around that. And the longer he held on, the worse it was going to get. The time for turning the page and starting a new chapter was over. He needed to close the book. Completely and entirely. Once and for all.
This was his goodbye.
“Your mom said I might find you here.”
He wouldn’t have heard the voice if it hadn’t been coming from right next to him. He hadn’t even noticed that someone had come up beside him. But it wasn’t as if he was surprised. It had always been in the raven-haired boys nature to appear when he was needed, be it in combat or emotional support.
“Well, she was right. I’m here.” He replied, his tone just loud enough to hear over the rumble of the water. He didn’t bother to look at his companion, blue eyes remaining fixed on the fountain. “I thought you were still off-planet.”
“Just got back. I’m between missions right now so I decided to take a little break. Check back to see how Earth was doing and all that.” The raven-haired boy answered, his voice carrying the same seriousness it always did. The kind of seriousness that was unpredictable yet reliable. The seriousness of a leader.
“The universe still saved?”
“Last I checked. Don’t worry, I didn’t come here to pull you out of retirement.”
“Then why are you here, Keith?” It wasn’t a hostile question, but rather an honest sort of curiosity.
The raven-haired boy was silent for a minute and both stood listening to the rush of water. It was a comfortable silence. One filled with years of companionship and trust. Finally, he said, “Because I had this feeling that I needed to see you. Can’t really explain it. Just seemed like where I needed to be right now.”
That caused blue eyes to shift for the first time, gaze turning to meet indigo. They were the same eyes that he had seen a million times before in a million different situations. They were the same eyes that held a fierce determination while rushing into battle whether it be on foot or in a lion. They were the same eyes that watched the desert sunset, taking in the beauty that Earth had to offer. They were the same eyes that watched the universe learn to stand back up on its feet.
And yet…
They were different. There was something in them that he had never seen, something mysterious yet so familiar. And whatever it was, it seemed to alleviate some of weight from his shoulders. It seemed to calm the rising tide of hurt and pain that was swelling in his chest. It seemed to take his heart and hold it in place.
“So what’s your wish?” The raven-haired boy asked, nodding his head towards the fountain. “That’s why you came here, right? To make a wish?”
By some miracle, he was able to find his voice. “I can’t tell you that. It won’t come true.”
“Do you want it to come true?”
“Yeah...I think I do...” And it was true. Moments ago he would have given anything to get her back. He would have traveled to the ends of the universe if it meant he could see her again. But now...now he wasn’t so sure. Something had brought the raven-haired boy here today. Some card had been played. Some chance had been taken. And while he didn’t fully understand it, he felt like he was almost getting permission to move on. To move forward.
“Well, I have a wish.” The raven-haired boy said, fishing a penny out of his jacket pocket. “But I’ll only make it if you make yours.”
“You’re not afraid? To wish, I mean.”
The raven-haired boy shrugged. “Not really. A wish is just like asking for a little help, don’t you think? It doesn’t change whether or not the thing will happen. That’s your decision to make.”
“My decision?” He asked, grip loosening around the coin still in his hand.
The raven-hair boy gave a nod. “Yep. If you think it’s time to let her go, then you will. The wish will make it just a little easier.”
“Wait, how did you…?”
“Lucky guess.” The raven-haired boy replied with a small smile.
“You really think some silly wish will make moving on easier?” He asked, a slight shake to his voice. He could feel water start to build on the edges of his vision. He didn’t try to blink it away.
“I do. It might not be obvious though.” The raven-haired boy let out a small chuckle, eyes shining with amusement. “Maybe someone new will come along. Or maybe someone you already knew will feel some weird urge to come see you.”
“Seems a little far-fetched, don’t you think?” He asked, a single tear escaping and running down his cheek despite the half-smile that appeared on his face.
“It could happen...but you won’t know until you make your wish.”
Blue eyes turned back to the fountain, finding that the thought of throwing his penny in didn’t seem so heavy, so world-ending. Letting her go didn’t mean she was gone. It just meant that he was ready to take the next step and the one after that and the one after that. And when he really thought about it, that’s what she would want. She wasn’t coming back and for the first time, he was okay with that.
Because maybe...just maybe...he had found someone that could fill the hole she had left.
“Same time?” He asked, holding up his penny for the raven-haired boy to see. “On the count of three?”
“Count of three.”
“One…”
“Two…”
“Three.”
He watched as the two copper pennies flew through the air, gleaming under the afternoon sun. They fell almost soundlessly into the fountain, breaking the surface of the water for only a moment before it returned to its usual churning motion. They were suspended for a second before hitting the bottom, only a few inches between the two.
The usual regretful ache was nowhere to be found as blue eyes stared at the two pennies. Instead, he found a lightness had filled him, a certain relief that he hadn’t realized he’d been waiting for.
“Think it’ll come true?” He asked, a soft smile on his face.
“I think it already has.” Came the reply, the raven-haired boy’s voice far gentler than he had ever heard it before.
Blue eyes once again met indigo. “What’d you wish for?”
The raven-haired boy shook his head slightly. “I can’t tell you, Lance. It won’t come true.”
“I think it already has.”
#klance#voltron#VLD#lance mcclain#keith kogane#lagnst#what is this?#is it even good?#I don't even know anymore...#Redjay writes
37 notes
·
View notes
Link
Here it is! Part 4! Enjoy!
Title: Forget About Ghosts, Demons are the Fucking Worst - Part 1
Series: It’s Just Me, You, And These Fucking Ghosts
Rating: T
Words: 19.8k
Summery:
“Pidge told you where they were going, right? To the woods?” Lance said. “If...If it came down to it, would you go?” “Yeah…” Keith answered, voice quiet. “I would.” Lance didn’t respond. He only tightened his grip on Keith’s hand and let out a shaky breath. It was the kinda breath that Keith could feel in the deepest part of him. The kind that spoke volumes without a word being uttered. It was worry. It was regret. It was fear. It was resignation. But most of all, it was bravery. And while to most, bravery would be a sign of comfort, a sign that maybe everything would turn out okay, to Keith, Lance’s bravery could really only mean one thing. The situation was so much worse than he could ever possibly imagine. ~~~ OR an AU where your favorite team becomes ghost hunters! Featuring: Keith 'I've got trauma!' Kogane Lance 'I hate Carol' McClain Pidge 'I'm just here for the food' Gunderson Adam 'I didn't ask for this' W. Takashi 'MIA' Shirogane Allura 'MIA' whatever her last name is Hunk 'MIA' Garret and Matt 'I'm here too now and also missing' Holt
#klance#voltron#vld#keith kogane#lance mcclain#ghost hunters AU#part 4#It's finally here!#Redjay fic#Redjay writes
21 notes
·
View notes
Photo
Coming soon: Thirteen Hours by Redjay
Summery:
Sometimes the new door opens before the old has shut. Sometimes the fall comes before the jump. The spark without a match. The thunder with no lightning. The beginning without an end.
Such things ignite chaos, mess with the order the world has so kindly offered. But chaos isn’t always bad and leaping before you look can lead to adventures far greater than ourselves. Given time, the chaos becomes clear and the universe opens up before us.
Who knew that thirteen hours could lead to revelations the heart could never dream of?
Keith certainly didn’t.
Hey guys. I haven’t just been sitting on my hands. In between writing some other stuff I’ve been working on this beauty right here. It’s a little different from what I usually write but I’m super excited for it and I hope you guys are too.
This will be a 13 part story with each chapter depicting what happens in one hour of the story. And it’s Klance so like...it’s gonna be good no matter what.
And because I’m so excited, I’ll even give you a sneak peek:
6pm
Palms came down hard on the table, causing Keith to jump, glancing up in the process. He wasn’t surprised to see stormy blue eyes shifting between him and the others seated at the table. He’d been expecting the outburst for awhile now, it being over an hour since anyone had said a word.
Piles of books and papers were spread out in front of him, not in the least bit disturbed by the sudden motion of his tablemate. Keith had been reading through his psychology notes, trying helplessly to understand the never ending list of vocab that he had to have memorized in only a few short days. A half-chewed pen cap rested between his teeth, forgotten as he examined the brown-haired boy across the table from him.
Tan skin was flushed, whether from frustration or exhaustion, Keith wasn’t sure. Soft strands of short brown hair were disheveled, a product of stressed fingers pulling at the locks. Lips were pressed together in a hard line, jaw clenched far too tightly. Steely eyes scanned over the table, making sure all attention was on him before he spoke.
“I can’t take this anymore!” Lance practically shouted, causing glares from the surrounding tables to be shot his direction. He didn’t seem to pay any mind to them as he continued. “The semester is over in, like, a week and all we do is study and drink way too much coffee. We’re going to go crazy from caffeine overdose at this point.”
Keith couldn’t help the glance he threw at his currently empty coffee cup. He had been debating making another run to the library cafe. It would’ve been his fifth cup that day.
It was Shiro who spoke up first, an almost apologetic look on his face. “Exam week is right around the corner, Lance.” His tone was even and understanding. “And some of us are graduating. We can’t afford to make any mistakes.”
“That’s my point!” Lance argued, a slight whine to his voice. “In a week we probably won’t see you or Allura for a really long time. Do you really want our last memories together to be studying in some stupid library for an exam you probably won’t remember anyway?”
“They’re not dying.” Pidge said, snickering from behind their laptop screen while pushing their glasses up.
“I know that.” Lance shot at them sharply. “But Allura’s going to be moving all the way across the country and Shiro’s just straight up going to work in Japan for a whole year. They might as well be dying.”
“Okay, buddy.” Hunk cut in, setting down the pencil he had been taking notes with. “That’s a bit of an overstatement, don’tcha think? We can still call and text them and stuff.”
Lance shook his head. “I know, I know but…” He took a deep breath before continuing. “We won’t be able to do anything all together. No more movie nights. No more late night food runs. No more weekend trips to the beach.”
“Lance…” Allura said, voice soft and eyes gentle. “We’ve known that doing stuff like that has been coming to an end for awhile.”
“But it’s not the end yet.” Lance countered, glancing around the table again. “Look, it’s Friday night. Our last Friday night before the semester is over. We should do something fun. Something that doesn’t include textbooks and coffee.”
“What? You wanna do like a one last hurrah kinda thing?” Pidge asked, giving Lance a curious glance, intrigue gleaming from behind their glasses.
“Yes! Exactly!” Lance replied, eyes lighting up and head nodding frantically. “One last big, exciting, fun, wild night. Just the six of us.”
7 notes
·
View notes
Text
Hey guys! It’s been a hot second but I’m here to tell you that part 4 of the It’s Just Me, You, and These Fucking Ghosts series is just around the corner. If not by the end of this coming week then for sure the week after. It’s quite a monster of a story so it’s been taking me a little longer than anticipated.
But for now, have a little update on the spooks to come:
Everything was quiet. The only sound he could hear was his own breathing, too loud in the silence. Everything was black. No matter which way he looked, all he could see was nothing. It was suffocating, pressing down on his chest in an almost unbearable way. Everything was cold. He could feel the goosebumps raise on his arm as the chill set in. It dug its way into his skin, tearing down into his very bones.
This wasn’t right. Something was wrong. Very wrong. He shouldn’t be here. He’d left this place behind. Gotten out. Escaped. So why was he back?
“Now I lay me down to sleep…”
Keith jumped at the sudden voice in his ear, losing his balance in the process. He instinctively reached out for something, anything, to grab onto, but all his fingers found was air.
And so he fell. Hard.
His back hit something solid, cutting short the cry of pain that came involuntarily from his throat. An ache started to radiate outwards from his back, pulsing as fast as his heart was beating. He could feel the terror start to worm its way into his mind, clawing at the rational thoughts that had been keeping it at bay. He knew what came next. He knew that he wasn’t alone in this darkness. He knew what was waiting for him if he didn’t get away right now.
“I pray the lord my soul to keep…”
The voice this time was much louder, as if it was coming from all sides of him at once. The words cut into him, injecting the fear directly into his heart. He could feel his limbs stiffen, freezing from the panic that had starting to swirl within him. His breaths came out rapidly as he dug his fingers into the floor beneath him, latching onto anything he could in hopes that it would provide him some chance for survival. His eyes darted around, searching hopelessly for the source of the voice, praying that he would spot the entity before it had a chance to strike.
“If I should die before I wake…”
The agonizing scream Keith let out from the sudden burning sensation on his leg was drowned out by the deafening loudness of the voice that seemed to be coming from all sides of him. Pain shot through his body, causing white spots to dance in his vision.
“I pray the lord my soul to take.”
#klance#voltron#vld#keith kogane#horror#ghosts#spooks#I'm getting pumped guys#this is gonna be so good#Redjay speaks#Redjay writes
16 notes
·
View notes
Text
It’s Just Me, You, and These Fucking Ghosts
The reviews are in for the It’s Just Me, You, and These Fucking Ghosts series! Here they are:
“All I can say is that this is the best fanfic series I've read in a long time. I can't wait to see what happens next!!!!” - Riniginianna
“Love this series so much. Great writing, great plot and everyone is in character even though it's an AU. <3″ -BlackFrair
“Ahh amazing! I love this entire series, you write it so well just like everything else!” - ImyourCardiganAngel
So check it out if you’re looking for a fun, fluffy, horror-filled, well-written Klance series. Great for binging or for reading in small doses!
Series summery:
What happens when a skeptic and a believer come face-to-face with the spirits of the dead? Is it possible to survive that which can't be seen? Can certain feelings come to light while looking in the darkest places?
All those questions and more are answered in this ghost hunter AU in which your favorite team finds themselves in some pretty terrible places while hunting some pretty terrible things. Featuring: -Lance McClain as the believer AND -Keith Kogane as the skeptic
Are you in the mood for some spooks AND some fluff? Well, my friend, you've come to the right place!
Part 1 - Ghosts are Pretty Bad but You’re the Fucking Worst
Part 2 - I May be the Worst but at Least I’m Not a Fucking Ghost
Part 3 - I’ve Changed My Mind, Ghosts are the Fucking Worst
Part 4 - Forget About Ghosts, Demons are the Fucking Worst (Part 1)
#klance#voltron#vld#shameless self promotion#keith kogane#lance mcclain#ghost hunters AU#Redjay fic#Redjay writes
10 notes
·
View notes
Photo
Just a reminder that the first chapter of Thirteen Hours is up on Ao3 right now. You can find the link to it by either clicking on the picture or clicking HERE.
Here’s a sneak peek of chapter 2 which will be coming soon:
“Keith! Incoming!”
Keith was pulled from his thoughts, the unmistakable sound of Pidge’s voice rising over the usual city noises. He didn’t have time to turn around before he felt a weight slam into his back, sending him stumbling a few steps forward, almost falling over entirely. The air was pushed out of his chest at the impact, leaving him gasping for a moment as the sight of Shiro and Allura in front of him started to spin. Next to him he could hear Lance’s musical laugh, no doubt finding way too much amusement in Keith’s struggle to remain upright
“Christ, Pidge…” Keith said, voice somewhat raspy, as he felt arms wrap around his neck, knees digging into either side of his waist. “A little more warning next time.”
He heard Pidge let out a laugh, their voice coming from right behind him before he felt the weight of a chin rest on his shoulder. “I’m tired of walking and Hunk refused to let me ride on his back.” They said as if that explained their actions in any way.
“You’re too heavy!” Hunk called lightly from a few steps behind them.
Keith grunted, hefting his small friend up a little higher, arms wrapping under their knees to hold them in place. “And so you just tackle me? What if I fell?”
“Pssh, as if.” Pidge replied dismissively. “You never miss leg day.”
“What does that have to do with anything?” Keith asked, tone dry.
“No, it makes sense.” Lance replied, nodding his head but not explaining further than that.
“Uh-huh…” Keith said flatly, deciding that he could never understand the minds of morons. “But why me? Why not Lance?”
Keith felt an arm detach from around his neck a moment before a hand hit him lightly upside the head, a ‘tsk’ following it. “Everyone knows that Lance has noodle arms. He would drop me.”
“Hey!” Lance cut in, voice rising. “I’ll have you know I’m strong! I give piggyback rides to my niece and nephew all the time!”
“Those are kids, though.” Pidge pointed out. “I’m a full-grown adult.”
“Well…” Keith said smugly, knowing that he would get a rise out of Pidge. “A very small full-grown adult.”
“You shut up.” Pidge replied darkly, pulling lightly on a strand of his hair. “You’re not exactly a skyscraper either.”
“I’m, like, an inch shorter than Lance!” Keith retorted, sending a glare over his shoulder at Pidge.
“And it’s that inch that makes all the difference.” Lance said wistfully, not trying to hide the mocking tone to his voice. “How sad that you’ll never know what the view’s like from up here. A true tragedy, wouldn’t you say Hunk?”
Hunk fell into step beside Lance, throwing an arm over his shoulder and sighing. “Indeed, my tall friend.”
“They’re insufferable.” Pidge said, anger lacing their words. “C’mon, Keith. We don’t need to listen to this. Us short people gotta stick together.”
“Don’t put me in the same league as you! I’m not that short!” Keith replied, exasperated.
“I’m sorry, I can’t hear you all the way down there. Could you speak up?” Lance replied, raising a hand to his ear and leaning towards Keith, drawing a laugh from Hunk.
Keith felt a fire light inside him, the flames coursing through his veins. Before he could say anything, though, Pidge spoke.
“Hey, Keith. Did you know that on average tall people die younger than short people?” Their words were sharp, clipped from their own irritation.
Keith angled a dangerous glare at Lance and Hunk, his own voice filled with venom. “Huh. Interesting. I guess we have something to look forward to then.”
4 notes
·
View notes
Text
It’s been a few days and I’m almost 10,000 words in so here’s another little snippet from part four of my ghost hunters AU to hold you over:
“It was, like, the first week of school...and Shiro and I had just moved to the city.” Keith said, leaning back on his hands, eyes staring up at the stars once more. “So I didn’t really know anyone.”
“Yeah, you were a real loner back then.” Lance agreed.
“Thanks.” Keith said dryly before continuing. “It was during passing period. Most people would avoid me. Like, they walked on the opposite side of the hall and stuff. I think...I think people were afraid of me for some reason…?”
“Probably because you always looked pissed off.” Lance pointed out. “You were scary back then...sometimes still are.”
“Do you want me to tell the story or would you rather just keep interrupting me?” Keith asked, no real animosity behind his words.
“Sorry, sorry.” Lance said with a wave of his hand, offering Keith a bright smile. “Please continue.”
Keith rolled his eyes before speaking again. “I was at my locker, getting stuff for my next class. And out of nowhere, something hit the locker door. Hard...which then hit me. Hard.”
“I don’t like where this story is going…” Lance muttered sheepishly.
“So I’m dizzy, of course, from being hit in the head by a locker door and instead of a, I dunno, ‘sorry’? Or maybe a ‘my bad’? Do you know what I hear?”
“I’m not gonna like the answer…”
“I hear ‘Watch out, shorty. Someone might accidentally step on you.’ Which isn’t even clever, by the way.”
Lance covered his face with his hands and groaned, but didn’t say anything.
“I look over to see this tall, gangly, twig-like-”
“I get it.” Lance cut in darkly, looking up from his hands.
“-kid walking away and the only thing that I can think is ‘someone actually talked to me’.”
“Wait, what?” Lance said, a mixture of confusion and surprise in his voice. “I make fun of you and that’s your response?”
Keith shrugged. “It wasn’t like I was afraid of you or anything. No offense but you’ve never really been that intimidating.”
“Lies!” Lance shot at him. “I’m super intimidating!”
“Not even a little.” Keith deadpanned.
#klance#voltron#keith#lance#ghost hunters AU#Redjay writes#also all of these snippets are the unrevised versions#so if they're not up to snuff I apologize
14 notes
·
View notes
Text
Tomorrow.
Here’s the last sneak peak to hold you over until then:
“Here we go.” Lance said, abruptly cutting into Keith’s train of thought. “‘While the strange ghost girl has been spotted year round, reports claim that she appears most often during the month of June. No one knows why.’ Well, I guess that’s what Pidge meant by window of opportunity. It’s almost July.”
“I guess they weren’t lying about the whole ‘ghosts are seasonal thing’.”
“I guess not...but why June? I mean, maybe like October I could understand. But June? Seems kinda random.”
Keith couldn’t help but roll his eyes. “Maybe because it’s made up.”
“Made up? Who would make up something like that?” Lance asked, eyeing him disbelievingly.
“I never said it was intentional.” Keith replied. “There’s gonna be more hikers in the summer. It’s warmer. A lot of people take vacations then. So obviously there’s gonna be more reports.”
“Seriously? That’s your reasoning?” Lance said with a scoff. “Then how do you explain all of them seeing the exact same girl, huh?”
“You know how people are.” Keith retorted. “One person starts yelling about some creepy girl in the woods and suddenly everyone wants to be a part of the fun.”
“Or counterpoint,” Lance said dryly. “They all saw the same creepy girl in the woods and you’re just too stubborn to admit that Alwater is haunted by some small child.”
“Not stubborn. Realistic.”
“Christ...I can’t fucking stand you sometimes.” Lance said, crossing his arms over his chest and letting out an angry huff.
“Which is why you agreed to rent a house with me...and get a dog with me...and come with me to save our friends-”
“Okay! Shut up! You’ve made your point!” Lance yelled, shooting a glare at him. “Also the dog was my idea so...there!”
“Ah, yes. You’ve definitely won this one.” Keith said flatly, eyes not leaving the road.
“Ya know, just because I like you and stuff doesn’t mean you’re not the biggest prick I know.” Lance spat at him, turning to look out his window angrily.
“Like me? What are you? Some hormonal teenager who can’t admit his own feelings?” Keith asked, resisting the urge to roll his eyes again.
“Nope.” Lance said, popping the ‘p’. “Only boyfriends who are nice to me get the ‘L’ word. It’s my new rule.”
“Since when?”
“Since right now.”
“Good lord…” Keith muttered. “The only child we’re gonna find in that forest is you.”
8 notes
·
View notes