text:
How long is my number?
Challenge
Given an integer \$Q\$ in the range \$-2^{100} ≤ Q ≤ 2^{100}\$, output the number of digits in that number (in base 10).
Rules
Yes, you may take the number as a string and find its length.
All mathematical functions are allowed.
You may take input in any base, but the output must be the length of the number in base 10.
Do not count the minus sign for negative numbers. The number will never have a decimal point.
Zero can either have one or zero digits.
Assume the input will always be a valid integer.
Examples
Input > Output

-45 > 2
12548026 > 8
33107638153846291829 > 20
-20000 > 5
0 > 1 or 0

Winning
Shortest code in bytes wins.

Brachylog, 1 byte
l

Try it online!
Another builtin solution, but this one has the shortest name (unless someone finds a language which does this task in zero bytes). This should work in both Brachylog 1 and Brachylog 2.
This is a function submission (the TIO link contains a command-line argument that causes the interpreter to run an individual function rather than a whole program), partly because otherwise we'd have to spend bytes on output, partly because Brachylog's syntax for negative numbers is somewhat unusual and making this program a function resolves any potential arguments about input syntax.
It's often bothered me that most of Brachylog's builtins treat negative numbers like positive ones, but that fact ended up coming in handy here. I guess there are tradeoffs involved with every golfing language.

This is where I stop scrolling... this is outrageous!

Taxi, 1118 bytes
1 is waiting at Starchild Numerology.Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.Pickup a passenger going to Crime Lab.'-' is waiting at Writer's Depot.Go to Writer's Depot:n 1 l 3 l.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 1 r 2 r 2 l.Switch to plan "n" if no one is waiting.-1 is waiting at Starchild Numerology.[n]0 is waiting at Starchild Numerology.Go to Starchild Numerology:s 1 r 1 l 1 l 2 l.Pickup a passenger going to Cyclone.Pickup a passenger going to Addition Alley.Go to Cyclone:e 1 l 2 r.[r]Pickup a passenger going to Cyclone.Pickup a passenger going to Addition Alley.Go to Zoom Zoom:n.Go to Addition Alley:w 1 l 1 r.Pickup a passenger going to Addition Alley.Go to Chop Suey:n 1 r 2 r.Switch to plan "f" if no one is waiting.Pickup a passenger going to Sunny Skies Park.Go to Sunny Skies Park:n 1 l 3 l 1 l.Go to Cyclone:n 1 l.Switch to plan "r".[f]Go to Addition Alley:n 1 l 2 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:n 1 r 1 r.Pickup a passenger going to Post Office.Go to Post Office:n 1 l 1 r.

Try it online!
Ungolfed:
1 is waiting at Starchild Numerology.
Go to Post Office: west 1st left 1st right 1st left.
Pickup a passenger going to Chop Suey.
Go to Chop Suey: north 1st right 1st left 4th right 1st left.
Pickup a passenger going to Crime Lab.
'-' is waiting at Writer's Depot.
Go to Writer's Depot: north 1st left 3rd left.
Pickup a passenger going to Crime Lab.
Go to Crime Lab: north 1st right 2nd right 2nd left.
Switch to plan "n" if no one is waiting.
-1 is waiting at Starchild Numerology.
[n]
0 is waiting at Starchild Numerology.
Go to Starchild Numerology: south 1st right 1st left 1st left 2nd left.
Pickup a passenger going to Cyclone.
Pickup a passenger going to Addition Alley.
Go to Cyclone: east 1st left 2nd right.
[r]
Pickup a passenger going to Cyclone.
Pickup a passenger going to Addition Alley.
Go to Zoom Zoom: north.
Go to Addition Alley: west 1st left 1st right.
Pickup a passenger going to Addition Alley.
Go to Chop Suey: north 1st right 2nd right.
Switch to plan "f" if no one is waiting.
Pickup a passenger going to Sunny Skies Park.
Go to Sunny Skies Park: north 1st left 3rd left 1st left.
Go to Cyclone: north 1st left.
Switch to plan "r".
[f]
Go to Addition Alley: north 1st left 2nd left.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery: north 1st right 1st right.
Pickup a passenger going to Post Office.
Go to Post Office: north 1st left 1st right.

Explanation:
Pickup the input and split it into individual characters
Pickup the value 1.
If the first character a hyphen, add -1. Otherwise, add 0.
Keep picking up characters and adding 1 until you're out.
Convert the running total to a string and print to stdout.

I've been a lurker in this exchange for a long time, but have never seen something like this

@CupofJava https://codegolf.stackexchange.com/a/57064/65836

Will this run out of gas if the number is long enough?

This is a bigger brainfuck than brainfuck.

@RobertFraser That's why we stop at Zoom Zoom in every loop of plan "r". I just tested it up to 100,000 digits and it never ran out of gas. I didn't calculate it but I suppose it takes in more than enough fare to pay for the gas it's using so it fills up the tank on every loop.

@CupofJava Welcome to esoteric languages. Chicken, Cow, and Unary are some that I find the most hilarious. I presumed that would be more Taxi on PCG but it looks like just me and Erik the Outgolfer.

@CupofJava OH MY GOSH how did I forget about Shakespeare.

Mathematica, 13 bytes
IntegerLength

There's a built-in... returns 0 for 0.

Mathematica prevails :D

not in code golf it doesn't :)

There's a built-in: When isn't there?

dc, 3
?Zp

Note that normally dc requires negative numbers to be given with _ instead of the more usual -.  However, in this case, either may be used.  If - is given, then dc treats this as a subtraction on an empty stack, throws dc: stack empty, and then continues with the rest of the number; Thus the result is no different.
Try it online.
?    # input
 Z   # measure length
  p  # print

Couldn't this just be Z as a function submission? dc's a concatenative language with quote+dup+eval operators, it can therefore reuse arbitrary strings of code.

Retina, 2 bytes
\d

Try it online!
Retina doesn't really know what numbers are, so the input is treated as a string and we simply count the digit characters.

05AB1E, 2 bytes
Äg

Try it online! or Try All Tests!
Ä  # Absolute value
 g # Length

Ä, huh? Not þ? Fair enough.

@carusocomputing I thought of Ä first, but þ would handle a decimal point, so it's a little better I guess.

Just cool how 2 people came up with 2 different 2 byte solutions within 2 minutes of each other, I don't think there's a third though; trying to think of one.

Alice, 16 bytes
//; 'q<)e
o!@i -

Try it online!
Explanation
Finding a half-decent layout for this was quite tricky. I'm still not super happy with it because of the spaces, the < and the ;, but this is the best I could do for now.
String length is one of those very common built-ins that doesn't exist in Alice, because its input is a string and its output is an integer (and all Alice commands are strictly integers to integer or strings to strings). We can measure a string's length by writing it to the tape in Ordinal mode and then finding its end in Cardinal mode.
/      Reflect to SE. Switch to Ordinal. While in Ordinal mode, the IP will bounce
       diagonally up and down through the code.
!      Store an implicit empty string on the tape, does nothing.
;      Discard an implicit empty string, does nothing.
i      Read all input as a string.
'-     Push "-".
<      Set the horizontal component of the IP's direction to west, so we're bouncing
       back now.
-      Remove substring. This deletes the minus sign if it exists.
'i     Push "i".
;      Discard it again.
!      Store the input, minus a potential minus sign, on the tape.
/      Reflect to W. Switch to Cardinal. The IP immediately wraps to the
       last column.
e)     Search the tape to the right for a -1, which will be found at the end
       of the string we stored there.
<      Does nothing.
q      Push the tape head's position, which is equal to the string length.
'<sp>  Push " ".
;      Discard it again.
/      Reflect to NW. Switch to Ordinal. The IP immediately bounces off
       the top boundary to move SW instead.
o      Implicitly convert the string length to a string and print it.
       IP bounces off the bottom left corner, moves back NE.
/      Reflect to S. Switch to Cardinal.
!      Store an implicit 0 on the tape, irrelevant.
       The IP wraps back to the first line.
/      Reflect to NE. Switch to Ordinal. The IP immediately bounces off
       the top boundary to move SE instead.
@      Terminate the program.

I also tried taking care of the minus sign in Cardinal mode with H (absolute value), but the additional mode switch always ended up being more expensive in my attempts.

brainfuck, 37 bytes
-[+>+[+<]>+]>->,[-<->]<[>+>],[<+>,]<.

Output is by byte value.
Try it online!
Explanation
-[+>+[+<]>+]>->  Constant for 45 (from esolangs wiki)
,                Read a byte of input
[-<->]           Subtract that byte from 45
<[>+>]           If the result is nonzero then increment a cell and move to the right
                 (0 means it was a minus; so not counted)
,[<+>,]          Read a byte and increment the cell to its left until EOF is reached
<.               Print the cell that was being incremented

Is it possible to add a footer to the TIO link which outputs the result as a number?

@BetaDecay Added

That's brilliant, thanks :D

PHP, 23 Bytes
<?=-~log10(abs($argn));

Try it online!
log of base 10 of the absolute value plus one cast to int
for zero as input log10 gives back INF which is interpreted as false
The better way is to replace $argn with $argn?:1 +3 Bytes
PHP, 27 Bytes
<?=strlen($argn)-($argn<0);

string length minus boolean is lower then zero
+2 Bytes for string comparision $argn<"0"
Try it online!
PHP, 32 Bytes
<?=preg_match_all("#\d#",$argn);

Try it online!
Regex count all digits
35 Bytes
<?=strlen($argn)-strspn($argn,"-");

Try it online!
string length minus count -
strspn

The first one doesn't work, for example, for 10, because ^ has lower priority. You can fix it with -~.

Why not simply <?=strlen(abs($argn)); ?

@user63956 The version with log10 can't work in cases of input zero so I delete it.

@roberto06 if i use abs for higher numbers the string will be interpreted as 1.0E+64 for example gives back 7 and not 64

@JörgHülsermann Why not just $argn?:1? It would be 26 bytes with log10() and abs().

@user63956 I was a little confused through your first post. I am not sure if you forget to add 1 or cast to int. I count 28 Bytes

@JörgHülsermann -~$x is equivalent to ((int)$x)+1. <?=-~log10(abs($argn?:1)); seems to work.

@user63956 Yes it works now I have understand what you mean. Thank You And we can remove the ternary operator cause log10(0) is interpreted as false

Fortran 95 (gfortran), 121 96 95 bytes
program c
character b
call get_command_argument(1,b,length=i)
print*,i-index(b,'-')
end program

Explanation:
Subtracts the index of the '-' sign from the length of the argument.
Arrays start at 1 in Fortran, and index() returns 0 if symbol not found.
Edit: Switched to implicit integer "i", also consolidated argument getter.
Edit: -1 byte thanks to @Tsathoggua

Welcome to PPCG!

GNU AWK, 18 17 15 bytes
$1=gsub(/\w/,1)

Substitutes every number character (except for the minus sign) alphanumeric character of the input for another character (here, the number 1), and assigns the number of substitutions to the output.
Thanks for cnamejj and manatwork for helping me saving some bytes!
Try it online!
AWK, 17 bytes
$1=gsub(/[^-]/,1)

This is a previous answer, that should work on any Awk version, not only GNU's.
Try it online!

Welcome to Code Golf, nice first answer!

You could use gsub(".",1) to knock off a few more characters too.  Nice idea for how to do this BTW.

Thanks, guys! @cnamejj I could not make this work with negative numbers.

You're right...  I mis-read the problem description, sorry about that!

@cnamejj you have just gave me an idea to regex every character, but the minus sign. I'll save one byte.

Although there is no \d in AWK, we still have \w (at least in gawk, but not in mawk), which is good enough in this case.

@manatwork wow! I missed that by a mile! Thanks for pointing that out.

PowerShell, 24 Bytes
"$args"-replace'-'|% Le*

casts the "absolute" value of the input args to a string and gets the 'length' property of it.
1 byte shorter than "".Length
until someone finds a better way to get the abs of a number in PS this is probably as short as it will get.

How about "$args".trim('-')|% Le* ? :)

05AB1E, 2 bytes
þg

Try it online!
   # Implicit input [a]...
þ  # Only the digits in [a]...
 g # length of [a]...
   # Implicit output.

Ruby, 15 11+1 = 16 12 bytes
Uses the -n flag.
p~/$/-~/\d/

Try it online!
Explanation
                  # -n flag gets one line of input implicitly
p                 # Print
 ~/$/             # Position of end of line (aka string length) in input
     -            # minus
      ~/\d/       # Position of first digit (1 if negative number, 0 otherwise)

What magic is this?

@Chowlett added an explanation.

Python 2, 31 22 bytes
-9 bytes thanks to Rod.
lambda i:len(`abs(i)`)

Try it online!

len(\abs(s)`)` with number as input is shorter

Too bad Python doesn't have function composition. It would be just len∘repr∘abs.

Jelly, 2 bytes
DL

Try it online!
This does literally what was asked:
DL - Main link number n         e.g. -45
D  - convert to a decimal list       [-4,-5]
 L - get the length                  2

That's an interesting built-in there, does D work on decimals? Would -1.2 output [-1,-0.2]? Tried it myself, it does not.

Not quite, the base conversion only goes down to the units so, for example, 654.321D would yield [6,5,4.321] (well actually [6.0,5.0,4.321000000000026])

[-6.0, -5.0, -4.321000000000026], actually, apparently.

Ah - yeah just edited - floating point arithmetic.

CJam, 5 bytes
q'--,

String based.
Try it online!
9 bytes for a purely math-based solution:
riz)AmLm]

Or another 5 with base conversion:
riAb,

Or also 5: rizs,.

JavaScript (ES6), 27 26 25 24 bytes
Takes input as a string.
s=>s.match(/\d/g).length

Saved two bytes thanks to Arnauld.

Your title says 23 bytes, but your code is 24... However, this is 23 bytes: s=>`${s>0?s:-s}`.length!

Thanks, @DomHastings. You should post yours as a separate answer as it's a different approach to mine.

Brain-Flak, 63 bytes
([({})]((((()()()()())){}{})){}{})((){[()](<{}>)}{})([{}][]<>)

Try it online!
This is 62 bytes of code and +1 byte for the -a flag.
I tried two other approaches, but unfortunately both of them were longer:
([]<({}[((((()()()()())){}{})){}{}]<>)((){[()](<{}>)}{})>)({}[{}])

([]<>)<>({}<>)((((([][]())){}{})){}{}[{}])((){[()](<{}>)}{})([{}]{})

This should be a very short answer. In fact, if we didn't have to support negative numbers, we could just do:
([]<>)

But we have to compare the first input with 45 (ASCII -) first, which is most of the byte count of this answer.
An arithmetic solution might be shorter.

I count 62 bytes..?

@totallyhuman see my edit.

49 bytes: ([{}]((((()()()()())){}{})){}{})({(<()>)}{}[]<>)

Japt, 5 bytes
a s l

Try it online!
Explanation
 a s l
Ua s l
Ua     # take the absolute value of the input
   s   # and turn it into a string
     l # and return its length

Ruby, 20 bytes
->a{a.abs.to_s.size}

FYI: in order to call it you do: ->a{a.abs.to_s.size}[-95]

or just classic way - ->a{a.abs.to_s.size}.call(-92)

not a golfy way :D

RProgN 2, 2 bytes
âL

Try it online!
Simply gets the absolute value of the input, and counts the digits.

Pyth, 4 bytes
l`.a

Try it online!
All test cases

Perl 5, 9 + 1 = 10 bytes
$_=y/-//c

Try it online!
Run with -p (1 byte penalty).
Explanation
$_=y/-//c
            {implicit from -p: for each line of input}
   y/ //    In {the input}, replace
        c     everything except
     -        '-'
$_=         Store number of replacements back in $_
            {implicit from -p: output $_}

We treat the input as a string in order to handle numbers outside the 64-bit range. One interesting trick here is that we don't have to specify what we're replacing the nonhyphens with; we can still count the number of replacements that occur.
The TIO link uses -l in order to let us run the program on multiple data without the newlines between them interfering. If the program only has to run once, we can do without it, so long as there's no final newline on the input.

R, 18 bytes
nchar(abs(scan()))

JavaScript (ES6), 23 bytes
s=>`${s>0?s:-s}`.length

Different approach to Shaggy's answer.

s=>s.length-(s<0) saves 6 bytes

Java, 30 24 bytes
i->(""+i.abs()).length()

Assumes i is a BigInteger. Also, the type is contextualized, so no imports are required, as shown in the test code.
Test
// No imports
class Pcg120897 {
  public static void main(String[] args) {
    java.util.function.ToIntFunction<java.math.BigInteger> f =
        // No full class declaration past here
        i->(""+i.abs()).length()
        // No full class declaration before here
      ;
    System.out.println(f.applyAsInt(new java.math.BigInteger("-1267650600228229401496703205376"))); // -(2^100)
    System.out.println(f.applyAsInt(new java.math.BigInteger("1267650600228229401496703205376"))); // (2^100)
  }
}

Saves

30 -> 24 bytes : thanks to @cliffroot

+"" instead of .toString() ?

+1 for providing sample code showing how this is invoked and for clarifying the type of i in your answer. I think more lambda answers should do this.

V (vim), 20 bytes
:s/-
C<C-r>=strlen(<C-r>")
<esc>

Try it online!
Remove minuses(if any), cut the line, and get its length.
Not sure if I need the <esc> at the end.

I don't think you need the final , at that point the solution is there, no need to exit from insert mode

Risky, 2 bytes
!?}*

Try it online!
! length
?     input
}   base convert
*     10

FALSE, 14 bytes
^45=[1+^~][]#.

Try it online!
Explanation:
If first character is '-' (ascii code 45), then push -1. Else push 0. Add 1 to number on stack until EOF character is reached.

C++, 80 76 bytes
#include<string>
int main(int,char**c){printf("%d",strlen(c[1])-(*c[1]<46));}

Prints the length of the argument, minuses 1 if the first character is a minus because bool guarantees conversion to 1 if true or 0 if false

4 bytes thanks to @Squidy for pointing out I can use <46 instead of =='-', and to deference the array instead of []

You could shave off 4 bytes by replacing c[1][0]=='-' with *c[1]<46 since we can assume the input will always be a valid integer. (Unless prefixes other than '-' are allowed...)

@Squidy oh wow nice find! I racked my brain for ages trying to shorten this and never even came up with that! Thanks for the suggestion, and especially for signing up to PCCG to let me know!

-1 byte by replacing (*c[1]<46) with 45/ *c[1], note the whitespace is necessary, otherwise it would be parsed as the start of a comment

Alice, 10 bytes (non-competing)
 /d/
O@IHc

Try it online!
This is a non-competing solution, because at the time this challenge was posted the command c was bugged in the official (and only :D) interpreter. Martin Ender fixed it in the meanwhile, so this now works.
Explanation
The instruction pointer passes through the two mirrors (/) multiple times, so it may be a bit difficult to follow. I'll try to explain it as clearly as I can, using cardinal directions (e.g. N is up, SW is down to the left...).
I'll call /1 the leftmost mirror, and /2 the rightmost one.
Command    Direction    Comment
               E        Execution starts from the upper-left corner going right
   /1        E → SE     Passing through the mirror changes direction and switches
                        to ordinal mode (string operations)
   I        SE → NE     Push the input string to the stack, then bounce against
                        the bottom of the code
   /2       NE → S      Back to cardinal mode (numeric operations)
   H           S        Pop n, push abs(n). Execution wraps from bottom to top
   /2        S → SE     Ordinal mode again
   c        SE → NW     Pop s, push each char of s separatedly. Bounce against
                        the bottom right corner
   /2       NW → W      Cardinal mode
   d           W        Push the depth of the stack (which is now equal to
                        the number of characters in abs(input))
   /1     W → NW → SW   Pass through the mirror, then bounce agains the top
   O        SW → NE     Output the result, then bounce on the bottom left corner
   /1       NE → S      Last mirror, I promise
   @           S        Terminate execution

REXX 22 Bytes
arg "-" a
say length(a)

Explanation:
There is no distinction in Rexx between numbers and strings. The action you perform is what defines the type. The "typing" applies just to that action and can change at any time.
So, here the number (say -20) is treated as a string. The "arg" instruction (short for parse arg) tells Rexx to search for the first "-" and then put everything after it in the variable "a". If "-" is not found then everything goes in "a".
Try it here
REXX functions and instructions

Pari/GP, 13 bytes
n->#digits(n)

Try it online!

Jelly, 5 bytes
A‘l⁵Ċ

Try it online!

GNU Make, 78 bytes
Imperative style:
$(eval T=$1)$(foreach D,$(shell seq 9),$(eval T=$(subst $D,? ,$T)))$(words $T)

Functional style, 113 bytes:
$(eval 2?=$(shell seq 9))$(if $2,$(call $0,$(subst $(word 1,$2),? ,$1),$(wordlist 2,$(words $2),$2)),$(words $1))

Pure Make, 83 bytes:
$(eval T=$1)$(foreach D,0 1 2 3 4 5 6 7 8 9,$(eval T=$(subst $D,? ,$T)))$(words $T)

Bash, 15 bytes
wc -L<<<${1//-}

Try it online!
Deletes - from input as array, and otputs length of longest line (wc -c returns one char more than length)

awk, 22 bytes
$1=length($1<0?-$1:$1)

Try it online!
All test cases

You can save one byte by using sqrt($1^2) to take the absolute value. TIO.

JavaScript, 23 bytes
x=>`${x<0?-x:x}`.length

TI-Basic (TI-84 Plus CE, OS 5.2+), 6 bytes
length(toString(abs(Ans

TI-Basic is a tokenized language; length( and toString( are two bytes each.
Ans is used as implicit input; the last (only) line's value is implicitly returned.
Pretty simple, takes the absolute value to get rid of a minus sign, converts to string, returns the length of the string.
A 6-byte mathematical approach that doesn't work for 0:
1+log(abs(Ans

Which calculators have toString(?

@kamoroso94 TI-84 Plus CE

Excel VBA, 15 Bytes
Anonymous VBE immediate window function that takes input from [A1] and outputs to the VBE immediate window
?[Len(Abs(A1))]

Bound, 4 bytes
ib_,

Explanation:
i # Get user input
b # Separate each digit of the top element into individual elements
_ # Put the total number of elements onto the stack
, # Remove all but the top element from the stack

Bound then prints the stack at the end of execution, so you can then see the result.
Try it online!

GolfScript, 5 bytes
"-"-,

Try it online!
"-"-    # Remove all "-" in the input
    ,   # Get the length of the string

APL (Dyalog Extended), 4 bytes
≢∘⍕|

Try it online!

BRASCA, 15 bytes
iM:45S=[xx0]x!n

Try it online!
Explanation
i                - Turn the ascii characters 0-9 to numbers
 M:45S=[  0]     - Move the bottom of the stack to the front and check if it's a minus
        xx       - If so: remove the minus
            x    - Remove any excess items on the stack
             !n  - Print the length as a number

Arn -s, 2 bytes
.|

Try it!
Take absolute value, -s takes size. Implicit casting.

PowerShell Core, 20 bytes
$args|% *m '-'|% Le*

Try it online!

Whispers v2, 39 bytes
> Input
>> |1|
>> "2"
>> #3
>> Output 4

Try it online!
Boring answer. Get input, absolute value, convert to string, return length.

Julia, 7 bytes
ndigits

Try it online!

Vyxal, 2 bytes
ȧL

Try it Online!
 L # Length of...
ȧ  # Absolute value of...
   # Implicit input

Factor + project-euler.common, 13 bytes
number-length

Try it online!

this has to be the only language with project euler builtins

@Razetime Factor's policy of including nearly every contribution with the base language is nice in some ways!

K (ngn/k), 17 bytes
{#$$[x<0;x*-1;x]}

Try it online!
Can't handle big numbers correctly, e.g. 33107638153846291829. Still decent though.

K (ngn/k), 11 bytes
{#($x)^"-"}

Try it online!
Easy.
Explanation:
{#($x)^"-"}    Main function. Takes x as input
  ($x)         x as string
      ^"-"     Without string literal "-" (Remove negative symbol)
 #             Length

You can take input as a string and change ($x) to x.

Fig, \$2\log_{256}(96)\approx\$ 1.646 bytes
LA

Try it online!
LA
L  # Length of
 A # The absolute value of the input

Fourier, 30 bytes
I~S<0{1}{-2*S~S}S{0}{S^~S}SL^o

Try it on FourIDE!
Fourier doesn't have strings, so it uses logs instead. Bytes are wasted on supporting zero and negative numbers.

MATL, 6 bytes
nGU0<-

Try it online!
Explanation
n     % Implicitly input a string. Push its length
G     % Push input again
U     % Convert to number (floating-point double). Although integers with absolute
      % value exceeding 2^53 cannot be represented exactly, the sign is correct
0<    % Is it negative?
-     % Subtract. Implicitly display

Befunge, 35 bytes
77*~`!1+:v
~0`#@    ># !#. #- #2_1+

Try it online!
77*~`!            add 49 to the stack and see if that is less than 50 (ascii for
                  '-')
1+:v              if there is a -, don't count it. Add 1 so we don't
                  have a zero at the top of the stack. Move down.
># !#. #- #2_1+   move right and add one to the total. (Will remove later)
~0`#@             Loop back around and take an input and make sure it is not end of
                  the string (-1, so we make sure it is > 0)
># !#. #- #2_1+   check to see if there was an input. If there was, add one to the
                  total. If not, move left. Subtract 2 because we added 1 at two
                  different locations. Print output and end program.

Bean, 20 bytes
Hexdump:
00000000: 2650 80d3 d080 a05d 2080 0921 8181 0020  &P.ÓÐ. ] ..!...
00000010: 8001 dc64                                ..Üd

JavaScript equivalent:
a.match(/\d/g).length;

Explanation:
Implicitly takes input as a decimal string in a and implicitly outputs the length of the match, which is all the decimal digits in the string. Returns 1 for input of 0.
See Demo.
Bean, 22 bytes
Hexdump:
00000000: 2aa0 1f26 4ccc d3a0 8043 53a0 802d 2043  * .&LÌÓ .CS .- C
00000010: 9125 398b 253a                           .%9.%:

JavaScript equivalent:
with(Math)((log10(abs(A))^0)+1);

Explanation:
Implicitly takes input as a decimal integer in A, takes the absolute value, then log-base-10, XORs with 0, then adds 1.
When A is 0, the returned value of log10() is -Infinity, and -Infinity ^ 0 is 0 in JavaScript, so the returned value for 0 is 1.
See Demo.

J, 7 bytes
#@":@**

Try it online!
All the solutions I came up with:
0>.@>.10^.>:@(**)
[:#10&#.inv
#@-.&'-'
#@":@**

The first one is math, the second is base conversion, the third takes a string as input, and the shortest takes a number.
The current solution looks like this:
              ┌─ #
        ┌─ @ ─┴─ ":
  ┌─ @ ─┴─ *
──┴─ *

The parent root is a hook between the upper tine and the lower tine. The lower tine (*) is a monad that calculates magnitude. The upper tine is a composition:
         ┌─ #
   ┌─ @ ─┴─ ":
@ ─┴─ *

This composes the upper tine (another composition) with *, in this case, a dyad. This is the dyad for multiplication. In the last tine:
   ┌─ #
@ ─┴─ ":

This calculates format (":) then length (#).
In English form, this is "multiply x times the sign of x, then convert this to a string, then take the length of this string". Basically, abs.toString.length.

C#, 33 bytes
i=>Math.Abs(i).ToString().Length;

You need to fully qualify Math and you can save bytes by using +"" instead of ToString().

MATL, 4 bytes
47>s

Inspired by Martin's Retina answer: count how many characters have code point exceeding 47 (this excludes the minus sign).
Try it online!

Braingolf, 2 bytes
dl

Explaination:
dl
    Implicit input from command-line args to stack
d   Pop last item from stack, split it into digits, and push each digit to the stack
 l  Push length of stack to the end of the stack
    Implicit output of last item on stack

Brain-Flak, 48 + 3 ( -a) = 51 bytes
({}[((((()()()()())){}{})){}{}]){(<><>)}{}([]<>)

Try it online!

C#, 28 bytes
s=>s.Replace("-","").Length;

C#, 24 bytes
n=>$"{n>0?n:-n}".Length;

Inspired from @DomHastings answer.

Chaincode, 5 bytes
pqL_+

Explanation
pqL_+ print(
    +   succ(
   _      floor(
  L        log_10(
pq           abs(
               input())))))

C, 43 bytes
f(char*s){printf("%d",strlen(s)-(*s==45));}

Try it online

T-SQL, 38 bytes
CREATE PROC l @ BIGINT AS PRINT LEN(@)

Usage:
EXECUTE l @ = 9999999999

If it's a negative int, it returns an extra number in the result. Probably need to add LEN(ABS(@))

Lua, 26 bytes
Replaces all occurrences of '-' with the empty string '' and get length with #.
print(#(...):gsub('-',''))

Try it online!

Axiom, 23 Bytes
f(x)==#(abs(x)::String)

Perl 5, 9 bytes + 3 for -F flag=12 bytes
say@F-/-/

Run like perl -F -E 'say@F-/-/'. Takes a single number from stdin without a trailing newline. Can add the -l flag at the cost of an extra byte if you would rather have it accept a trailing newline.
The -F flag auto splits stdin into the array @F. In scalar context, @F evaluates to the length of the array, which is the number of characters in $_ (which comes from stdin). /-/ in a numerical context evaluates to 1 if $_ has a minus sign in it or 0 if $_ does not have a minus sign in it, so @F-/-/ evaluates to the number of non-minus sign characters (i.e. the number of digit characters) read from stdin.

C, 71 38 bytes

-33 bytes FelipeNardiBatista

Try Online
f(char*t){return*t?(*t>'-')+f(t+1):0;}

why don't you just return the number?

golfed to 38 bytes

@FelipeNardiBatista changed now, thx

35 bytes

Swift, 138 bytes
You would think there would be an easier way to do this.
import Foundation;var d:(String)->Int={return $0.trimmingCharacters(in:CharacterSet(charactersIn:"0123456789").inverted).characters.count}

You can try it here
Un-golfed:
import Foundation // Import the Foundation module

var d:(String)->Int={ // Create a closure that takes in a String and returns an Int

    return // Return the following

    $0.trimmingCharacters(in:  // Removes all characters in the following CharacterSet

        CharacterSet(charactersIn:"0123456789").inverted // Create a CharacterSet with all characters that are not digits

    ).characters.count // Get the length of the resulting String
}

Desmos, 31 bytes
g=abs(a)
f(a)=floor(log(g+0^g))

Try it on Desmos!

Batch, 101 bytes
@set/pi=
@set o=-1&if %i:~,1%==- set o=-2
:l
@set/ao+=1&if %i%. neq . set i=%i:~,-1%&goto:l
@echo %o%

89 bytes
@set/pi=
@if %i% lss 0 set/ai=-%i%
:l
@set/ao+=1&if %i% gtr 9 set/ai/=10&goto:l
@echo %o%

Only works for 32-bit numbers.

MathGolf, 2 bytes
±£

Input as integers.
Try it online.
I'm actually surprised builtin £ works on integers. I was expecting I would need an explicit cast, since that's the case with a lot of MathGolf's builtins.
Explanation:
±   # Get the absolute value of the (implicit) input-integer
 £  # Pop and get the length of this integer
    # (after which the entire stack is output implicitly as result)

Japt, 2 bytes
ìl

Try it
ìl     :Implicit input of integer
ì      :Convert to digit array
 l     :Length

Thunno 2, 2 bytes
Al

Attempt This Online!
length of the Absolute value of the implicit input.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Calculate the inverse modulus
The task:
Output a value for x, where a mod x = b for two given values a,b.
Assumption

a and b will always be positive integers
There won't always be a solution for x
If multiple solutions exist, output at least one of them.
If there aren't any solutions, output nothing or some indication that no solutions exist.
Built-ins are allowed (not as fun as other mathematical approaches)
Outputs are always integers

Examples
A, B >> POSSIBLE OUTPUTS

5, 2 >> 3
9, 4 >> 5
8, 2 >> 3, 6
6, 6 >> 7, (ANY NUMBER > 6)
8, 7 >> NO SOLUTION
2, 4 >> NO SOLUTION
8, 5 >> NO SOLUTION
10,1 >> 3, 9

This is code-golf, so lowest bytes wins.

Can it error if no solution is found?

@ConfusedMr_C Technically that does indicate no solution, so yes.

JavaScript, 28 27 26 24 23 bytes
a=>b=>(a-=b)?a>b&&a:b+1

Try it online!
false indicates no solution.
-1 thanks @Arnauld

Nicely done and nicely golfed.

So, to call it, you need to give the outer function a name, say f=..., then call f(8)(3)? That seems a little bit cheaty? The normal way to call a function would be f(8,3), which would make your function definition longer?

@SteveBennett True, the definition is curried, which means it must be called like (8)(3), but there is a consensus on PPCG that that's allowed. You don't have to give it a name though.

Ugh, for a very, very weak definition of "consensus". Most comments were "I don't like it, but I don't have a clear argument against it". How gross.

@SteveBennett It's amusing how you think 26 vs -15 is anything but a clear consensus. Good luck trying to dispute.

A consensus is not the same thing as a vote count, in many contexts. It involves things like the weight of argument, who is taking each position, etc. I see a weak argument by analogy "well, I guess if it's ok for Haskell, it's ok for Javascript" and an awful lot of discomfort with that outcome.

@SteveBennett how is 55 to 1 a weak consensus?

Did you even read my two previous comments where I explained that?

MATL, 6 bytes
tQ:\=f

Try it online! Or verify all test cases.
Explanation
Consider inputs 8, 2 as an example.
t    % Implicit input. Duplicate                STACK: 8, 8
Q    % Add 1                                    STACK: 8, 9
:    % Range                                    STACK: 8, [1 2 3 4 5 6 7 8 9]
\    % Modulo                                   STACK: [0 0 2 0 3 2 1 0 8]
=    % Implicit input. Equality comparison      STACK: [0 0 1 0 0 1 0 0 0]
f    % Indices of nonzeros. Implicit display    STACK: [3 6]

Python 2, 40 34 bytes
-6 bytes thanks to Bubbler

lambda a,b:[(a==b)*-~a,a-b][a>b*2]

Try it online!

34 bytes: lambda a,b:[(a==b)*-~a,a-b][a>b*2]

Jelly, 5 bytes
‘R⁸%i

Returns the minimal valid x or 0 is there is none.
Try it online!

Groovy, 48 bytes (using built-in):
{a,b->Eval.me(a+"g").modInverse(Eval.me(b+"g"))}

Eval.me(...+"g") - Affixes "g" to the input, making it a BigInteger.
modInverse(...) - Performs the inverse modulo operation.

Java 8, 70 bytes
{a,b->return BigInteger.valueOf(a).modInverse(BigInteger.valueOf(b));}

R, 33 28 bytes
pryr::f(match(b,a%%1:(a+1)))

Try it online!
-4 bytes thanks to Jarko Dubbeldam.
-1 byte thanks to Giuseppe.
Returns NA if there is no solution.  TIO doesn't have the pryr library installed, so the code at that link uses function(a,b) instead.

pryr::f(which(a%%1:(a+1)==b))  is 4 bytes shorter.

you can also drop another byte by using match(b,a%%1:(a+1)), which returns NA for a missing value.

Jelly, 11 10 bytes
³%_⁴
r‘ÇÐḟ

A full program taking the two positive integers, a and b, and printing a list of the integer solutions between min(a,b)+1 and max(a,b)+1 inclusive.
Try it online!

Mathematica 36 Bytes
a_±b_:=Select[Range[9a],a~Mod~#==b&]

Input:
5 ± 2
9 ± 4
8 ± 2
6 ± 6
8 ± 7
2 ± 4
8 ± 5
10 ± 1

Output:
{3}
{5}
{3, 6}
{7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, \
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, \
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54}
{}
{}
{}
{3, 9}

When using these extended ASCII operators in a binary form, they need a space in front when being defined, otherwise the parser throws an error. So it would have to be a_ ±b_. But it's shorter to use Cases instead of Select an an unnamed function anyway: Cases[Range[9#],x_/;#~Mod~x==#2]&

Haskell, 33 bytes
Crashes with code.hs: out of memory (requested ??? bytes) if there is no solution (times out on TIO before that):
a!b=[x|x<-[b+1..],mod(a-b)x<1]!!0

Try it online!
Thanks at Ørjan Johansen for spotting a mistake!

This gives wrong answers for the test cases where b divides a.

C# (Mono C# compiler), 57 56 26 bytes
Port of Rod's Python answer.
Thanks to W W for -1 byte.
HUGE thanks to Kevin Cruijssen for -30 bytes.
a=>b=>a-b>b?a-b:a==b?a+1:0
Try it online!

Welcome to the site!  It looks like you can removed the space after return.

Welcome to PPCG! For non-recursive C# answers it's always best and shortest to use a lambda function (i=>{/*code here*/}). In this case however, since you have 2 inputs, it can be a currying lambda function to save an additional byte (a=>b=>{/*code here*/} instead of (a,b)=>{/*code here*/}). Also, you can remove the parenthesis around your if-checks. In total, without changing any of your functionality, it becomes a=>b=>a-b>b?a-b:a==b?a+1:0 26 bytes

Also, if you haven't seen it yet, Tips for golfing in  and Tips for golfing in C# might both be interesting to read through. Enjoy your stay! :)

Thank you all for the tips, I will keep these in mind when golfing in the future.

Pyth, 16 bytes
hhx!0mqeQ%hQdShh

Try it online!
All test cases
Takes input as [a, b], errors if no solution found. Will revise if erroring isn't allowed.

Axiom, 147 128 bytes
g(a:PI,c:PI):Union(List PI,Stream INT)==(a<c=>[];r:=a-c;r=0=>expand((a+1..)::UniversalSegment INT);[b for b in divisors(r)|b>c])

ungolf it and test
--a%b=c return all possible b
f(a:PI,c:PI):Union(List PI, Stream INT)==
    a<c=>[]
    r:=a-c
    r=0=>expand((a+1..)::UniversalSegment INT)
    [b  for b in divisors(r)|b>c]

(3) -> [[i,j,g(i,j)] for i in [5,9,8,6,8,2,8,10] for j in [2,4,2,6,7,4,5,1]]
   (3)
   [[5,2,[3]], [9,4,[5]], [8,2,[3,6]], [6,6,[7,8,9,10,11,12,13,14,15,16,...]],
    [8,7,[]], [2,4,[]], [8,5,[]], [10,1,[3,9]]]
                                                      Type: List List Any

This would find all the solution even the infinite set solution...

APL (Dyalog Unicode), 19 bytes
A←{(⍳⍵+1)/⍨⍺=⍵|⍨⍳⍵+1}

Try it online!
Golfing in progress...

Mathematica, 28 bytes
Which[#>2#2,#-#2,#==#2,#+1]&

PHP>=7.1, 51 Bytes
for([,$a,$b]=$argv;++$x<2*$a;)$a%$x!=$b?:print$x._;

Online Version

Pip, 9 bytes
a%,a+2@?b

Takes the two numbers as command-line arguments. Outputs the smallest solution, or nil if no solution exists. Try it online!
Explanation
           a, b are cmdline args (implicit)
  ,a+2     Range from 0 up to but not including a+2
a%         Take a mod each of those numbers
           (Note that a%0 returns nil; it emits a warning, but only if warnings are turned on)
      @?b  Find the index of the first occurrence of b in this list, or nil if it doesn't occur
           Autoprint (implicit)

For example, with input of 8 and 2:
   a+2   10
  ,      [0 1 2 3 4 5 6 7 8 9]
a%       [() 0 0 2 0 3 2 1 0 8]

The 0-based index of the first occurrence of 2 in this list is 3, which is our solution.

J, 14 bytes
(->]){-,~=*1+]

Try it online!
Translation of Rod's Python 2 solution.
How it works
The rare cases where a J code can be directly translated into Python.
(->]){-,~=*1+]  <=>  [(a==b)*(1+b),a-b][a-b>b]
         =*1+]        (a==b)*(1+b)
      -,~            [            ,a-b]
     {                                 [     ]
(->])                                   a-b>b

Japt, 13 bytes
UµV ?U>V©U:ÒV

Try it online!
Translation of eush77's JS solution.
The code is just (U-=V)?U>V&&U:-~V when transpiled to JS, where U and V are the two input values.

Ruby, 31 bytes
->a,b{(1..a+1).find{|x|a%x==b}}

Try it online!

Japt, 7 bytes
(Eventually) Outputs undefined if there's no solution.
@%X¥V}a

Try it here

Perl 6, 23 bytes
{grep $^a%*==$^b,^$a+2}

Try it online!
Anonymous code block that returns a list of possible values from 2 up to a+1

ORK, 566 bytes
When this program starts:
I have a inputter called I
I have a number called a
I have a number called b
I is to read a
I is to read b
I have a mathematician called M
M's first operand is a
M's second operand is b
M is to subtract
I have a number called n
n is M's result
M's first operand is b
M's second operand is n
M is to compare
I have a scribe called W
If M says it's less then W is to write n
If M says it's less then W is to write "\n"
M's second operand is a
M is to compare
If M says it's equal then W is to write a
If M says it's equal then W is to write a

Try it online!
Objects R Kool. Luckily, however, I didn't need to use any (besides the built-in ones) for this task.

F#, 40 bytes
let m a b=Seq.find(fun x->a%x=b){1..a+1}

Try it online!
Pretty straight-forward. Throws a System.Collections.Generic.KeyNotFoundException if no solution can be found.
You could also modify it to Seq.tryFind, which will return an int option, with None if no solution could be found.

05AB1E, 7 bytes
>Lʒ¹s%Q

Try it online or verify all test cases.
Explanation:
>          # First (implicit) input + 1
 L         # Create a range [1, n]
  ʒ        # Filter; only keep elements where:
   ¹s%     #  The first input modulo this value
      Q    #  Equals the second (implicit) input

Java 8, 26 bytes
a->b->a-b>b?a-b:a==b?a+1:0

Port of @Epicness' C# answer, after I golfed it a bit more.
Try it online.

><>, 21 bytes
Same trick as most posted solutions. First, we prepare all necessary values on the stack and then check the comparisons.
::r::{-:{)?nr=?!;1+n;

Try it online!

Whispers v2, 128 bytes
> Input
> Input
>> 1²
>> (3]
>> 1%L
>> L=2
>> Each 5 4
>> Each 6 7
>> L⋅R
>> Each 9 4 8
> {0}
>> {10}
>> 12∖11
>> Output 13

Try it online!
Returns a set of all possible solutions, and the empty set (i.e. \$\emptyset\$) when no solution exists.
How it works
Unsurprisingly, it works almost identically to most other answers: it generates a list of numbers and checks each one for inverse modulus with the argument.
If you're familiar with how Whispers' program structure works, feel free to skip ahead to the horizontal line. If not: essentially, Whispers works on a line-by-line reference system, starting on the final line. Each line is classed as one of two options. Either it is a nilad line, or it is a operator line.
Nilad lines start with >, such as > Input or > {0} and return the exact value represented on that line i.e > {0} returns the set \$\{0\}\$. > Input returns the next line of STDIN, evaluated if possible.
Operator lines start with >>, such as >> 1² or >> (3] and denote running an operator on one or more values. Here, the numbers used do not reference those explicit numbers, instead they reference the value on that line. For example, ² is the square command (\$n \to n^2\$), so >> 1² does not return the value \$1^2\$, instead it returns the square of line 1, which, in this case, is the first input.
Usually, operator lines only work using numbers as references, yet you may have noticed the lines >> L=2 and >> L⋅R. These two values, L and R, are used in conjunction with Each statements. Each statements work by taking two or three arguments, again as numerical references. The first argument (e.g. 5) is a reference to an operator line used a function, and the rest of the arguments are arrays. We then iterate the function over the array, where the L and R in the function represent the current element(s) in the arrays being iterated over. As an example:
Let \$A = [1, 2, 3, 4]\$, \$B = [4, 3, 2, 1]\$ and \$f(x, y) = x + y\$. Assuming we are running the following code:
> [1, 2, 3, 4]
> [4, 3, 2, 1]
>> L+R
>> Each 3 1 2

We then get a demonstration of how Each statements work. First, when working with two arrays, we zip them to form \$C = [(1, 4), (2, 3), (3, 2), (4, 1)]\$ then map \$f(x, y)\$ over each pair, forming our final array \$D = [f(1, 4), f(2, 3), f(3, 2), f(4, 1)] = [5, 5, 5, 5]\$
Try it online!

How this code works
Working counter-intuitively to how Whispers works, we start from the first two lines:
> Input
> Input

This collects our two inputs, lets say \$x\$ and \$y\$, and stores them in lines 1 and 2 respectively. We then store \$x^2\$ on line 3 and create a range \$A := [1 ... x^2]\$ on line 4. Next, we jump to the section
>> 1%L
>> L=2
>> Each 5 4
>> Each 6 7

The first thing executed here is line 7, >> Each 5 4, which iterates line 5 over line 4. This yields the array \$B := [i \: \% \: x \: | \: i \in A]\$, where \$a \: \% \: b\$ is defined as the modulus of \$a\$ and \$b\$.
We then execute line 8, >> Each 6 7, which iterates line 6 over \$B\$, yielding an array \$C := [(i \: \% \: x) = y \: | \: i \in A]\$.
For the inputs \$x = 5, y = 2\$, we have \$A = [1, 2, 3, ..., 23, 24, 25]\$, \$B = [0, 1, 2, 1, 0, 5, 5, ..., 5, 5]\$ and \$C = [0, 0, 1, 0, 0, ..., 0, 0]\$
We then jump down to
>> L⋅R
>> Each 9 4 8

which is our example of a dyadic Each statement. Here, our function is line 9 i.e >> L⋅R and our two arrays are \$A\$ and \$C\$. We multiply each element in \$A\$ with it's corresponding element in \$C\$, which yields an array, \$E\$, where each element works from the following relationship:
$$E_i =
\begin{cases}
0 & C_i = 0 \\
A_i & C_i = 1
\end{cases}$$
We then end up with an array consisting of \$0\$s and the inverse moduli of \$x\$ and \$y\$. In order to remove the \$0\$s, we convert this array to a set (>> {10}), then take the set difference between this set and \$\{0\}\$, yielding, then outputting, our final result.

C#, 53 bytes (83 with function heading)
static int F(int a, int b){
    for(int i=1;i<=a+1;i++){if(a%i==b)return i;}return 0;
}

Try It Online
First try at codegolf. Probably not the best language to use, nor the most efficient coding.

Remove the unnecessary whitespace to save about 10 or more bytes

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
What's the file extension?
Your challenge is to find the file extension of a provided filename:
hi.txt -> txt or .txt
carrot.meme -> meme or .meme
lol (undefined behavior)
what..is..this..file -> file or .file
.bashrc -> bashrc or .bashrc
T00M@n3KaPZ.h0wC[]h -> h0wC[]h or .h0wC[]h
agent.000 -> 000 or .000

You must get the text from the last .  or after the last . to the end of the string. The first capturing group match of the regular expression /\.([^.]+)$/ works, and so does splitting the input on .s and returning the last one.
The file name will always contain at least one ., but it may contain multiple .. (see examples)
The input will always match ^[.a-zA-Z0-9^!\[\]{}@$%+=]+$.

Please consider using the Sandbox in the future to get feedback on your challenges before posting them to the main site.

https://codegolf.meta.stackexchange.com/a/12432/59376 - Got this idea from your challenge.

@carusocomputing nice challenge!

why the negative votes? Is this challenge "exceedingly trivial" or so ?

@AbelTom edit history would suggest downvotes were for the lack of specifications in the first draft of this question.

@Arjun the downvote count seems to be slowly increasing. I have no idea why.

Are we allowed to take the length of the string as input?

Retina, 5 bytes
.*\.

Replaces everything and a dot with nothing at all.
Try it online!

JavaScript (ES6), 19 bytes
Returns the full filename when there's no file extension. I suppose this is an acceptable undefined behavior.

let f =

s=>s.split`.`.pop()

console.log(f("hi.txt"))               // -> txt
console.log(f("carrot.meme"))          // -> meme
console.log(f("lol"))                  // -> undefined behavior
console.log(f("what..is..this..file")) // -> file
console.log(f("T00M@n3KaPZ.h0wC[]h")) // -> h0wC[]h
console.log(f(".bashrc")) // -> bashrc

The point of undefined behavior is that anything goes. Although, nasal demons, while still undefined behavior, might fail the "no malicious programs" clause.

POSIX Shell, 13
echo ${1##*.}

Try it online.

Mathematica, 13 22 bytes
Edit: Not sure how I missed the ".bashrc" test case. Thanks to Artyer for keeping me honest.
FileExtension["a"<>#]&

If the input matches \.[^.]+, then FileExtension just returns the empty string, so we prepend the letter a. In any other case, prepending a doesn't affect output of FileExtension.

A Mathematica builtin...no surprise.

I'd be surprised if there weren't any mathematica builtins for any question possible

I don't have access to Mathematica, but I would suspect that .ext would result in nothing, which failes for .bashrc needing to output bashrc (It fails in Mathics)

Apparently it works

Mathematica just needs to meta built-ins Create Built-in XXXXXXXX.

@Artyer You are correct.

@MagicOctopusUrn Do you mean the Wolfram Function Repository? Just get your code approved there, and you can refer to it while golfing!

c function, 21

1 byte saved thanks to @Dennis.
3 bytes saved thanks to @JohanduToit.
2 bytes saved thanks to @Neil.
1 byte saved thanks to @algmyr.

f(s){s=rindex(s,46);}

Try it online.

If you're ok with using legacy POSIX functions you could use rindex to save a byte.

@algmyr Sure, it works fine on TIO, so I'll use it.  I'd never heard of rindex() before - thanks for the tip!

05AB1E, 4 bytes
'.¡¤

Try it online! or Try All Tests
'.   # Push '.'
  ¡  # Split on occurrences of '.'
   ¤ # Tail

What? I've never seen a split occurences in the wiki. Edit: Now I found it!

Japt, 3 bytes
2 bytes of code, +1 for the h flag.
q.

Explanation:
q.       Split the input by `.`
   -h    Return the last item

Try it online!

PHP, 21 Bytes
<?=pathinfo($argn,4);

Try it online!
is a shorter expression for

<?=pathinfo($argn)[extension];

pathinfo
PHP, 27 Bytes
<?=end(explode(".",$argn));

explode
Try it online!
PHP <7.0, 26 Bytes
<?=end(split("\.",$argn));

deprecated split

Are you counting a trailing newline for the first one? It should be 27 bytes, not 28.

@ConorO'Brien Thank You .I have count after copy and paste from the split version a \

The pathinfo() based one could be <?=pathinfo($argn,4);.

Neo4j Cypher, 24 bytes
return split($i,".")[-1]

Input is in a param (i), probably the only way for cypher to take input. Pretty straightforward. Cypher has never been used on PPCG before

Taxi, 1397 bytes
Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.[a]Pickup a passenger going to Narrow Path Park.Go to Narrow Path Park:n 1 l 1 r 1 l.Go to Chop Suey:e 1 r 1 l 1 r.Switch to plan "b" if no one is waiting.Switch to plan "a".[b]Go to The Babelfishery:n 1 l 1 l.[c]Go to Fueler Up:n.Go to Joyless Park:n 2 r.Go to Narrow Path Park:w 1 r 3 l.Pickup a passenger going to Cyclone.Go to Cyclone:w 1 l 1 r 2 l.Pickup a passenger going to Crime Lab.Pickup a passenger going to Joyless Park.'.' is waiting at Writer's Depot.Go to Writer's Depot:s.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 1 r 2 r 2 l.Switch to plan "c" if no one is waiting.Go to Narrow Path Park:n 5 l.[d]Pickup a passenger going to Chop Suey.Go to Chop Suey:e 1 r 1 l 1 r.Go to Narrow Path Park:n 1 l 1 r 1 l.Switch to plan "e" if no one is waiting.Switch to plan "d".[e]Go to Joyless Park:e 1 r 3 l.Switch to plan "f" if no one is waiting.Pickup a passenger going to Narrow Path Park.Go to Fueler Up:w 1 l.Go to Narrow Path Park:n 4 l.Switch to plan "e".[f]Go to Narrow Path Park:w 1 r 3 l.[g]Switch to plan "h" if no one is waiting.Pickup a passenger going to KonKat's.Go to KonKat's:e 1 r.Pickup a passenger going to KonKat's.Go to Narrow Path Park:n 2 l.Switch to plan "g".[h]Go to KonKat's:e 1 r.Pickup a passenger going to Post Office.Go to Post Office:s 3 r 1 l.

Try it online!
Taxi doesn't have a reverse function so this ballooned pretty quickly. The logic is:

Break the string into characters
Reverse the array
Iterate through each until a period is found, storing each in a FIFO array
Empty the array (because there's only one LIFO array available)
Dump the FIFO array into the LIFO array
Concatenate the LIFO array and output

V, 5, 3 bytes
Since more of this answer is unprintable than printable, here is a hexdump:
00000000: cd81 ae                                  ...

Try it online!
This uses Jan Dvorak's algorithm, it just happens to be a more efficient encoding of it.
Explanation:
Í       " Remove all occurrences of:
 0x81   "   Anything (greedy)
     ®  "   Followed by a dot

Old solution:
$T.d|

Explanation please?

@EriktheOutgolfer Done

Wait ® means followed by a dot? Lol that's weird.

GNU Make, 12 bytes
$(suffix $1)

Not using a builtin, 27 bytes:
$(lastword $(subst ., ,$1))

Batch, 10 bytes
@echo %~x1

Strangely competitive for once.

C# (Visual C# Interactive Compiler), 22 bytes
s=>s.Split('.').Last()

Implicit using System.Linq; FTW!
Try it online!

Vim, 5 bytes
$F.d0

Explanation: find last . in line, delete everything before it
Another, longer, but in my opinion still interesting approach with 9 bytes (notice the trailing new line)
d/.*\./e

This one works similarly, 5 bytes (again, trailing new line):
d?\.

PowerShell, 34 26 bytes
-8 bytes thanks to @mazzy
(Read-Host).Split('.')[-1]

Takes input from STDIN. Actually managed to golf it down shorter than the built-in.
PowerShell, 20 bytes
($args-split'.')[-1]

Takes input from commandline arguments. Big thanks to @mazzy again!
PowerShell (with built-in), 36 bytes
[IO.Path]::GetExtension((Read-Host))

you can save some bytes. try this ($args-split'.')[-1] see About Automatic Variables

Forth (gforth), 45 bytes
: f begin 1 -1 d+ s" ."search 0= until type ;

Try it online!
Code Explanation
: f              \ start a new word definition
  begin          \ start an indefinite loop
    1 -1 d+      \ remove the first character from the string
    s" ."search  \ find the length and starting address of the first substring that starts with '.'
    0=           \ check if '.' was found in the string
  until          \ end the loop if not
  type           \ output the result
;                \ end the word definition

Python 3, 29 bytes
print(input().split(".")[-1])

Rust, 34 bytes
|p|p.extension().or(p.file_stem())

Usable as a fn(&std::path::Path) -> Option<&std::ffi::OsStr>.
Try it online!

JS (ES6), 26 25 bytes
x=>/\.([^.]+)$/.exec(x)[1]

-1 byte thanks to Shaggy

document.querySelector('pre').innerText = (x=>/\.([^.]+)$/.exec(x)[1])("example.txt")
<input oninput = "document.querySelector('pre').innerText = (x=>x.match(/\.([^.]+)$/)[1])(this.value)" value = "example.txt">

Alternate, 29 bytes:
x=>(y=x.split`.`)[y.length-1]

Rulw seem allow x=>/\.[^.]+$/.exec(x)

JavaScript (ES6), 33 31 28 bytes
s=>s.slice(s.lastIndexOf`.`)

Spec change in comments removes the need for +1.
-3 bytes thanks to nderscore

-3 with slice and template string execution: s=>s.slice(s.lastIndexOf\.`)`

Jelly, 4 bytes
ṣ”.Ṫ

A monadic link taking the file name and returning the extension with no leading ..
Try it online!
How?
Literally does what was asked...
ṣ”.Ṫ - Main link: list of characters, f
 ”.  - literal '.'
ṣ    - split f at occurrences of '.'
   Ṫ - tail (get the last chunk)

sed, 8 bytes
s:.*\.::

Try it online!

Go, 85 bytes
Go is... troublesome.
import(."fmt"
."os"
."strings")
func main(){s:=Split(Args[1],".");Print(s[len(s)-1])}

Try it online!
A sample of parentheses from the code:
()(){([])([()])}

()(){([])([()])} — is it a valid Brain-Flak?

@eush77 It's technically valid Brain-Flak, since it will run without errors, but it doesn't do anything interesting/useful. It's either just the literal 2 with no instructions/commands or anything or an infinite loop that continuously allocates more memory, depending on input.

Using filepath.Ext will save you a few bites

Javascript (ES5), 38 bytes
function(s){return s.split(".").pop()}

Just so you know, the downvote was cast automatically by the Community user when your answer was edited. I consider this a bug.

plz fix that if you can!

Common Lisp, 57 bytes
(lambda(s)(#1=reverse(subseq #2=(#1# s)0(search"."#2#))))

Try it online (added some bytes to call this anonymous function and display returned string)
Explanation
(#1=reverse ...)     ;reverse is now accessible with #1# - saves 1 byte. I
                     ;also need to reverse output of function inside to
                     ;get extension in correct order
#2=(#1# s)           ;reverse of input string is now accessible with #2#
(search"."#2#)       ;I take reversed string and search for "." to get position of
                     ;first instance of "." in string from the end of it
(subseq ... 0 ...)   ;get part of reversed string,
                     ;starting from first character and ending just
                     ;before first occurance of "."
                     ;this gives reversed extension

I get substring of reversed string, starting from 0, ending on this

C#, 33 41 bytes
a=>a.Split('.').Last();

Edit as suggested:
using System.Linq;a=>a.Split('.').Last();

You need to include using Sytem.Linq; into your byte count

And also a=>a.Split('.').Last(); implicit return is shorter

@TheLethalCoder Thanks for suggested fixes, still new to this :)

I'm surprised this is longer than my solution using Path...

Java 8, 52 27 bytes
s->s.replaceAll(".*\\.","")

Try it here.
Replace everything before the last dot (and the dot itself) with nothing.
This is shorter than using split (s->s.split("\\.")[s.split("\\.").length-1];) or substring (s->s.substring(s.lastIndexOf('.'));).

Gema, 3 characters
*.=

Sample run:
bash-4.4$ gema '*.=' <<< 'what..is..this..file'
file

MATL, 8 7 bytes
46&YbO)

Try it at MATL Online!
Explanation
        % Implicitly grab input as string
46      % ASCII for '.'
&Yb     % Split the input string at the '.' characters
O)      % Retrieve just the last part
        % Implicitly print the result

Awk, 14 13 characters
(10 9 characters code + 4 characters command line option.)
{$0=$NF}1

Thanks to:

Robert Benson for spotting the unnecessary semicolon (-1 character)

Sample run:
bash-4.4$ awk -F. '{$0=$NF}1' <<< $'hi.txt\ncarrot.meme\nlol\nwhat..is..this..file\n.bashrc\nT00M@n3KaPZ.h0wC[]h'
txt
meme
lol
file
bashrc
h0wC[]h

You don't need the ;. and just FYI, awk '{$0=$NF}1  works, no command line option needed. Oh... I must be tired.  I see what you did there.  You do need the command line option.

Thank you, @RobertBenson. I have no idea why I put that ; there.

If there is always a character after the last ., then $0=$NF is enough, with -F. command line option.

Lua, 53 30 bytes
Replaces everything upto the last . with the empty string ''.
Double parenthesis to select only the first return value of gsub.
Any golfing tips are welcome, I'm rusty in lua...
print(((...):gsub('.*%.','')))

Try it online!

K (oK), 6 bytes
Solution:
*|"."\

Try it online!
Examples:
*|"."\"whats.up.txt"
"txt"
  *|"."\"T00M@n3KaPZ.h0wC[]h"
"h0wC[]h"

Explanation:
Split \ the input on ".", reverse | this list, and then take the first * one. K is interpreted right-to-left:
*|"."\ / the solution
  "."\ / "." split (\),
 |     / reverse
*      / first

FORTRAN 90, 87 bytes
CHARACTER(99)F,L
READ*,F;DO I=1,LEN(F)
IF(F(I:I)=='.')L=F(I:LEN(F))
ENDDO
PRINT*,L
END

A shorter version in FORTRAN 90.

FORTRAN 77, 137 bytes
      PROGRAMC;IMPLICITCHARACTER*99(F)
      READ*,F;DOI=LEN(F),1,-1;IF(F(I:I).EQ.'.')THEN
      PRINT*,F(I:LEN(F));EXIT;ENDIF;ENDDO;END

There is no space in PROGRAM C, nor in IMPLICIT CHARACTER. It works (!) in gfortran, but I'm not sure it works in others compilers. The program takes input from stdin and outputs the extension with the period. The total length of the file name is limited by 99.

SmileBASIC, 45 bytes
INPUT S$@L
E$=POP(S$)+E$ON"."==E$[0]GOTO@L?E$

Outputs extension with the period.

JavaScript, 21 bytes
x=>x.split('.').pop()

Explanation:
This code takes x.txt and turns it into a array. The last element of the array is the file type. This code uses the pop function to remove the last element. In the process, the pop function returns the last element.

+Dennis, I have turned it into a arrow function. Does this comply with the rules?

Yes, it is fine now. :) By the way, StackExchange uses @ to ping people, not +.

Save 2 bytes with x=>x.split`.`.pop().

Python 3, 46 bytes
-8 bytes thanks to Wheat Wizard and Scrooble
import sys
print(sys.argv[1].split('.')[-1])

EDIT: I fixed the code, and the filename is a command-line argument

Welcome to the site! This doesn't appear to work, so you should either fix, or delete this answer.

This works for 54

To get the last item of a list you can use -1 as the index instead of len(a)-1.  You could also probably change your input format to reduce the number of bytes.

Adding to WW's suggestion: if you use -1 rather than len(a)-1, you no longer need the assignment and can save quite a few bytes.

Kotlin, 17 bytes
split(".").last()

Beautified
split(".").last()

Test
data class Test(val input: String, val output: String)

val test = listOf(
        Test("hi.txt", "txt"),
        Test("carrot.meme", "meme"),
        Test("what..is..this..file", "file"),
        Test(".bashrc", "bashrc"),
        Test("T00M@n3KaPZ.h0wC[]h", "h0wC[]h"),
        Test("agent.000", "000")
)

fun String.f() =
split(".").last()

fun main(args: Array<String>) {
    for ((i, o) in test) {
        if (o != i.f()) {
            throw AssertionError()
        }
    }
}

TIO
TryItOnline

V, 4 bytes
òdt.

Try it online!
Recursively delete everything up to, but not including the next .

C++, 73 bytes
I'm a bit surprised that no one tried C++, since it's an easy one :
#include<string>
auto e=[](std::string s){return s.substr(s.rfind(46));};

And the code to test ( may have to iostream, initializer_list, and exception ) :
std::initializer_list<std::string> test{
    "hi.txt", // .txt
    "carrot.meme", // .meme
    "lol", // invalid string position
    "what..is..this..file", // .file
    ".bashrc", // .bashrc
    "T00M@n3KaPZ.h0wC[]h", // .h0wC[]h
    "agent.000" // .000
};

for (const auto& a : test) {
    try {
        std::cout << e(a) << '\n';
    }
    catch (std::out_of_range& r) {
        std::cout << "out of range exception : " << r.what() << '\n';
    }
}

And, as you may expect, like compilers, if there's undefined behavior, there's no undefined behavior. If there's no file extension, the function will throw a std::out_of_range exception, as said in cppreference

Turing Machine But Way Worse, 1315 1287 bytes
0 0 0 1 1 0 0
1 0 1 1 8 0 0
0 1 0 1 2 0 0
1 1 1 1 9 0 0
0 2 0 1 3 0 0
1 2 1 1 a 0 0
0 3 0 1 4 0 0
1 3 1 1 b 0 0
0 4 0 1 5 0 0
1 4 1 1 c 0 0
0 5 0 1 6 0 0
1 5 1 1 d 0 0
0 6 0 1 7 0 0
1 6 1 1 e 0 0
0 7 0 1 f 0 0
1 7 1 1 0 0 0
0 8 0 1 9 0 0
1 8 1 1 9 0 0
0 9 0 1 a 0 0
1 9 1 1 a 0 0
0 a 0 1 b 0 0
1 a 1 1 b 0 0
0 b 0 1 c 0 0
1 b 1 1 c 0 0
0 c 0 1 d 0 0
1 c 1 1 d 0 0
0 d 0 1 e 0 0
1 d 1 1 e 0 0
0 e 0 1 0 0 0
1 e 1 1 0 0 0
0 f 0 0 g 0 0
1 f 1 0 g 0 0
0 g 0 0 h 0 0
1 g 1 0 p 0 0
0 h 0 0 q 0 0
1 h 1 0 i 0 0
0 i 0 0 r 0 0
1 i 1 0 j 0 0
0 j 0 0 s 0 0
1 j 1 0 k 0 0
0 k 0 0 l 0 0
1 k 1 0 t 0 0
0 l 0 0 u 0 0
1 l 1 0 m 0 0
0 m 0 0 n 0 0
1 m 1 0 v 0 0
0 n 0 0 o 0 0
1 n 1 0 g 0 0
0 p 0 0 q 0 0
1 p 1 0 q 0 0
0 q 0 0 r 0 0
1 q 1 0 r 0 0
0 r 0 0 s 0 0
1 r 1 0 s 0 0
0 s 0 0 t 0 0
1 s 1 0 t 0 0
0 t 0 0 u 0 0
1 t 1 0 u 0 0
0 u 0 0 f 0 0
1 u 1 0 f 0 0
0 o 0 1 w 0 0
1 o 1 1 w 0 0
0 w 0 1 x 0 0
1 w 1 1 E 0 0
0 x 0 1 y 0 0
1 x 1 1 F 0 0
0 y 0 1 z 0 0
1 y 1 1 G 0 0
0 z 0 1 A 0 0
1 z 1 1 H 0 0
0 A 0 1 B 0 0
1 A 1 1 I 0 0
0 B 0 1 C 0 0
1 B 1 1 J 0 0
0 C 0 1 D 0 0
1 C 1 1 K 0 0
0 D 0 1 D 0 1
1 D 1 1 w 1 0
0 E 0 1 F 0 0
1 E 1 1 F 0 0
0 F 0 1 G 0 0
1 F 1 1 G 0 0
0 G 0 1 H 0 0
1 G 1 1 H 0 0
0 H 0 1 I 0 0
1 H 1 1 I 0 0
0 I 0 1 J 0 0
1 I 1 1 J 0 0
0 J 0 1 K 0 0
1 J 1 1 K 0 0
0 K 0 1 w 1 0
1 K 1 1 w 1 0

Try it online!
Wow, this is big.

Wow this is incredible!

Befunge-98 (FBBI), 50 bytes
{v
 >~:a`!#v_
--2*86:$<:u-10_v#
02-u0}>:#,_@   >00

Try it online!
Puts string onto stack, then iterates through it in reverse, putting each new character onto new stack.  Once a . is encountered, discard original stack and output new stack in 0gnirts format.

33 v1.0, 13 bytes
The behaviour of the y operator was changed in v1.1, so this program no longer works
Gets the file name passed as an argument and prints the extension (without leading '.') to standard output.
1bt'.'ywmcbtp

Explanation:
1b            (Gets the second item in argv, the filename input)
  t'.'y       (Splits that by '.')
       wmcb   (Gets the last element in the list)
           tp (Prints to standard output)

brainfuck, 45 bytes
,[>,]>+[[-]++[<->------]<---<[->+>+<<]>]>[.>]

Try it online!

Python3 (32 bytes)
f=input()
print(f[f.rfind('.'):])

Try it online!

Welcome to the site. You might like to include a link to Try it online! in your answer. TIO is widely used here because it's quite handy: not only does it let other people try out your code, it also creates pre-formatted CGCC submissions for you.

8086 Assembly (NASM) + DOS, 262 bytes source, 50 bytes assembled
I'm pretty new to assembly, but I thought I'd give this a try.
This is a full DOS program, not just a snippet.
section .bss
b resb 256
org 256
section .text
mov byte[b],254
mov ah,10
mov dx,b
int 33
mov bh,0
mov bl,[b+1]
add bx,b+2
mov bp,bx
l:sub bx,1
cmp byte[bx],46
jne l
mov byte[bx],10
p:mov ah,2
mov dl,[bx]
int 33
add bx,1
cmp bx,bp
jb p
int 32

Essentially, it reads a line of text into a buffer, seeks the end,
then seeks backwards until it reaches a .. Then it just prints
the rest of the string from that point on. I wasn't able to use
DOS's built-in print function, though, since that uses $ as
the end-of-string character, which the prompt says is a valid
character for the extension itself.
Here is the hexdump of the assembled binary:
00000000  c6 06 34 01 fe 88 e4 ba  34 01 cd 21 b7 00 8a 1e
00000010  35 01 81 c3 36 01 89 dd  83 eb 01 80 3f 2e 75 f8
00000020  c6 07 0a b4 02 8a 17 cd  21 83 c3 01 39 eb 72 f3
00000030  cd 20

Setanta, 66 34 bytes
gniomh(s){toradh roinn@s(".")[-1]}

Try it here!

Arn, 6 bytes
Ê^!⁺╔d

Try it!
Explained
Unpacked: :!".":}
    _ Variable initialized to STDIN; implied
  :! Split on
    "." String containing a period
:} Tail

APL (Dyalog Unicode), 10 bytes (SBCS)
⊃∘⌽'.'∘≠⊆⊢

-7 bytes after Bubbler's suggestion.
Try it online!
APL (Dyalog Unicode), 17 bytes (SBCS)
⊃⌽'.'(1↓¨,⊂⍨⊣=,)⍞

Explanation
⊃⌽'.'(1↓¨,⊂⍨⊣=,)⍞
                ⍞ string input
            ⊣=,)  get characters, evaluate if they are equal to the left arg '.'
         ,⊂⍨      enclose each part after a dot
  '.'(1↓¨         drop each dot in the strings
 ⌽                reverse the split string array
⊃                 take the first value

Try it online!

Including the dot is allowed (so you don't need 1↓¨), but then, you can use ≠⊆⊢ idiom to split the words at dots, excluding dots.

Then the tacit ⊃∘⌽'.'∘≠⊆⊢ is one byte shorter than full program ⊃⌽'.'(≠⊆⊢)⍞.

interesting. I'll try it out. How do it get it to work on TIO?

No different from other function submissions.

Or equally long: ⊃∘⌽⎕NPARTS

Vyxal, 4 bytes
\.€t

Try it Online! (Test cases!)
Splits on spaces and outputs the tail.

C (gcc), 50 bytes
p;char*f(char*s){for(;*s;)p=*s++^46?p:s;return p;}

Try it online!
C (gcc), 45 bytes skipping return
p;char*f(char*s){for(;*s;)p=*s++^46?p:s;s=p;}

Try it online!
C (gcc), 24 bytes by ceilingcat
#define f(s)rindex(s,46)

Try it online!

Python 2, 25 bytes
lambda s:s.split('.')[-1]

Try it online!

Brain-Flak, 84 bytes
Includes +2 for -rc
(()){{}([((((()()()){}())()){}{}){}]({}<>)<>)({()(<{}>)}{})}{}{{}}<>{}{({}<>)<>}<>

Try it online!
# Push 1 to start the loop
(())

# Start loop
{{}

  # If TOS == 46 i.e. '.'
  ([((((()()()){}())()){}{}){}]({}<>)<>)({()(<{}>)}{})
  # ^------------------------^ ^-------^
  #           This is 46         Also, copy TOS to other stack

# End loop after the first '.'
}{}

# Delete everything from this stack
{{}}

# Delete the '.' that got copied
<>{}

# Copy everything back to reverse it to the correct order
{({}<>)<>}<>

Japt, 6 5 bytes
q'. o

Try it online!
Explanation
 q'. o
Uq'. o
Uq'.    # Split the input at "."
     o # Return the last item

When you only need to return the last item of an array, you can use o in place of gJ. (Learned that trick from @obarakon a while back)

Charcoal, 6 4 bytes
-2 bytes thanks to Erik the Outgolfer
⊟⪪Ｓ.

Try it online!
Explanation
⊟      Pop
  ⪪ .  Split on "."
   Ｓ  Next input as string
       Implicit print of value

Can't you use ⊟x instead of §x±¹?

jq, 15 14 characters
(11 10 characters code + 4 characters command line options.)
./"."|last

Sample run:
bash-4.4$ jq -Rr './"."|last' <<< 'what..is..this..file'
file

On-line test

Octave, 24 bytes
@(x)strsplit(x,'.'){end}

Creates an anonymous function named ans which can accept a string as input
Online Demo

C#, 47 34 27 bytes
System.IO.Path.GetExtension

Saved 6 bytes thanks to @totallyhuman.
Try it online!

Since it's a built in I think you don't need the lambda. System.IO.Path.GetExtension.

@milk Of course I do, that's just a method, it won't return .ext from file.ext because with just a method there's no way of passing the file.ext in.

This is all you have to do.

@totallyhuman Thanks, saved another byte by dropping the trailing semi colon to.

Pyth, 5 bytes
ecz\.

try it here

REXX 53
parse value reverse(arg(1)) with e "."
say reverse(e)

C#, 35 bytes
s=>s.Substring(s.LastIndexOf("."));

Try it online!

Haskell, 32 30 29 bytes
-1 byte thanks to Laikoni
r=reverse
r.fst.span(/='.').r

self-explanatory

takeWhile can be shortened to fst.span.

C (gcc), 77 60 52 bytes
char*f(char*s){for(s+=strlen(s);*--s-46;);return s;}

Try it online!
-17 bytes from Jonathan Frech
-8 bytes by removing i and doing arithmetic on s directly
Ungolfed (same strategy):
char *extension(char *original) {
    original = original + strlen(original);
    while(original[0] != '.') --original;
    return original;
}

60 bytes.

24 bytes

Cheddar, 16 bytes
@.sub(/.*\./,"")

simple regex solution. Alternative solution using split:
@.split('.')[-1]

Ruby, 16 bytes
->s{s[/[^.]+$/]}

Try it online!

15 bytes with -p

or, 14 bytes if "..." are acceptable :p

Ohm v2, 5 bytes
I..ï⁾

Try it online!

Perl 5, 8 bytes
7 bytes code + 1 for -p.
s;.*\.;

Try it online!

SNOBOL4 (CSNOBOL4), 46 bytes
	I =INPUT
S	I '.' REM . I	:S(S)
	OUTPUT =I
END

Try it online!
Takes the input, then repeatedly replaces it with all the text following the first . until no .s remain, then outputs the value.

><>, 18 bytes
i:0(6$.:"."=?]
ro|

Try it online!
How It Works:
i:(6$.  Jump to the second line if out of input
      :"."=  Else check if the character is a .
           ?[ And create a new stack if it is
              Loop back to the beginning of the line
If it is end of input
ro|  Reverse the current stack once and output, erroring on the EOF (-1)

Stax, 4 bytes
'./H

Run and debug online!
Explanation
Split on ., take last part.

T-SQL, 48 bytes
SELECT RIGHT(F,CHARINDEX('.',REVERSE(F))) FROM T

SQL Fiddle

Funky, 26 bytes
s=>(k=s::split".")[(#k)-1]

Try it online!

Jotlin, 17 bytes
split(".").last()

Full file:
data class Test(val input: String, val output: String)

val test = listOf(
        Test("hi.txt", "txt"),
        Test("carrot.meme", "meme"),
        Test("what..is..this..file", "file"),
        Test(".bashrc", "bashrc"),
        Test("T00M@n3KaPZ.h0wC[]h", "h0wC[]h"),
        Test("agent.000", "000")
)

fun String.f() = split(".").last()

for ((i, o) in test) {
    if (o != i.f()) {
        throw AssertionError()
    }
}

Excel, 58 bytes
=TRIM(RIGHT(SUBSTITUTE(A1,".",REPT(" ",LEN(A1))),LEN(A1)))

Excel VBA, 29 bytes
An anonymous VBE immediate window function that takes input via cell [A1] and outputs to the console. Return string is of the form .Extension.
?Mid([A1],InStrRev([A1],"."))

Yabasic, 34 bytes

A basic answer
Takes input as a string from STDIN, and outputs of the form .Extension to STDOUT.
Input""s$
?Mid$(s$,RInStr(s$,"."))

Try it online!

Google Sheets, 25 bytes
An anonymous worksheet function that takes input from cell A1 and outputs the detected file extension of the form Extension to the calling cell.
=RegexExtract(A1,"[^\.]+$

><>, 50 bytes
i:0( ?v
v[:<2~<
r  ^]+1r<
>:"."=?v^
v?l<r~r<;
>o ^

Try it online!

ActionScript 2.0, 42 bytes
function a(b){trace(b.split(".").pop());};

Technically the ;s aren't required for it to compile, at least in JPEXS, but it's good practice. Call:
a("a.b");

(traces "b")

Oh, OK. Looking at other examples, I didn't realise that. ActionScript doesn't really have a way to take inputs, so sure, delete this. Unless...

Looks good. Happy golfing.

Awesome. By the way, putting the trace() inside the function is shorter when considering outputting, but then it requires a string be included when calling the function - is that allowed?

I'm not quite sure what you mean by it requiring a string to be included when calling the function as I hardly know any Actionscript. In general it's allowed to mix and match any of the default allowed input and output methods.

function a(b){trace(b.split(".").pop());}; prints the output and is only 42 bytes, but calling the function would be a("a.b");
ActionScript has syntax very similar to JavaScript, so you can pretty much just read it like JavaScript.

If that is valid Actionscript then I think that would be fine. The only thing is that it is not actually shorter (nor is it longer) than what you currently have so you can use whichever you like without an impact on your score.

Let us continue this discussion in chat.

CJam, 6 bytes
q'./W=

Try it online!
        Print
    W     the last
     =    element
   /      of the result of splitting
q         the input
 '.       on the character '.'

Add++, 9 bytes
L,"."$tbU

Try it online!

Aceto, 6 bytes
r'.:Qp

Try it online!

r       grabs input as string
 '.     literal period
   :    split string on period
    Q   grap bottom item
     p  print it

Red 9 bytes
Suffix? f

Assumes file is is in word 'f

Do you have a link to documentation or interpreters for that language?

I don't think this does what the challenge asks.  The challenge is asking for a program that takes the file name and gives the extension.

Pepe, 48 bytes
rEeeEeEEEeREEeREEEerEEREEEEEEEreererEEEEeEeereee

Try it online!

R, 40 26 bytes
-14 bytes thanks to J.Doe

sub("^.*[.]","",scan(,""))

Try it online!

26 bytes

MBASIC, 129 bytes
1 INPUT F$:F=INSTR(F$,"."):IF F=0 THEN END
2 FOR I=LEN(F$) TO 1 STEP -1:P$=MID$(F$,I,1):O$=P$+O$:IF P$="." THEN PRINT O$:END
3 NEXT

Explanation
Get a filename. If it doesn't contain a period, bail out.
Otherwise, collect letters from right to left to build an output string.
When we see a period, print the string.
Output
? hi.txt
.txt

? .bashrc
.bashrc

? T00M@n3KaPZ.h0wC[]h
.h0wC[]h

Emacs, 6 bytes
The cursor needs to be at the start of the line containing the string.
This will delete the entire line if there's no extension.
C-<SPC> C-e C-r . <RET> <BACKSPACE>

Explanation:
C-<SPC>      start a selection
C-e          go to the end of the line
C-r . <RET>  search for "." backward
<BACKSPACE>  delete the selected text (which should be the text before the last ".")

Pushy, 13 bytes
K46-$v;F@46+"

Try it online!
               \ Implicit: string on stack as character codes
K46-           \ Subtract 46 from each code point, mapping '.' to 0
    $v;        \ While the top of stack is non-zero, move to auxiliary stack
       F       \ Copy auxiliary stack onto main stack
        @      \ Reverse (to obtain original order)
         46+   \ Add 46 (to obtain original characters)
            "  \ Print as a string.

Brain-Flak, 76 bytes
{((((([()()()]){}){}){}()){}{}<>)<>}<>{({}(((()()()()()){}()){}()){}<>)<>}<>

Try it online!
Explanation:
{          loop over stack
  (                            push
    (((([()()()]){}){}){}()){} -46
  {}                           plus the top of the stack
  <>)                          to the other side
<>}        retuen for more

<>      on the other side...

{       loop until 0
  (                             push
     {}                         the top of the stack
     (((()()()()()){}()){}()){} +46
  <>)                           to the first side
<>}       return for more

<> print the first side

6 bytes less than the other Brain-Flack solution.

Pip, 8 bytes
@R:a^"."

Try It Online!
-2 from emanresu A.

This can be 8 bytes - Try It Online!

Keg, -hd, 4 bytes
\./÷

Try it online!
Splits on dots, and prints the last element.

sed, 14 bytes
:l
s/.\././
tl

Try it online!
Just repeatedly removes the character before a . until there's none left.

Factor, 14 bytes
file-extension

Try it online!

Arturo, 24 bytes
$[s]->last split.by:"."s

Try it

Python 3, 25 bytes
lambda f:f.split('.')[-1]

Everyone probably knows this works, so I'm not gonna put a TIO link.

This is a duplicate of this answer

Still, counts towards Python THREE, not Python TWO

Raku, 12 bytes
m/.<-[.]>*$/

14 to make it a callable block:
{m/.<-[.]>*$/}

Try it online!

Zsh, 7 bytes
<<<$1:e

Try it online!

Thunno 2 t, 3 bytes
'./

Attempt This Online!
Explanation
'./  # Implicit input
  /  # Split the input on
'.   # The "." character
     # Implicit output of last item

Groovy, 37 bytes
{it.substring(it.lastIndexOf(".")+1)}

Try it online!

How did someone already upvote this lol. Literally 1 second after I hit submit it hit +1.

Ruby, 21 bytes
->f{f.split('.')[-1]}

Try it online!
12 bytes
File.extname

Julia, 22 bytes
g(n)=split(n,'.')[end]

Tcl, 21 bytes
puts [file ext $argv]

Try it online!

Perl 6, 11 bytes
{m/\.\w+$/}

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Broken Path Detection
Challenge
Given a plot with broken paths, return the plot with all paths connected in the minimum number of changes.
Explanation
This problem deals with graphs on the Cartesian plane. Every node has 8 possible edges, extending vertically, horizontally, or diagonally. Each direction is represented by a number 0-7 as follows:
        0
     7     1
  6     X     2
     5     3
        4

In other terms:
0 = North
1 = Northeast
2 = East
3 = Southeast
4 = South
5 = Southwest
6 = West
7 = Northwest

A "broken path" occurs when one node has an edge that would reach another node, but the node it reaches toward does not have the corresponding path to reach it. For example, assume we have nodes A, B, C, and D laid out as:
AB
CD

If node A has the path 2 and all the other nodes have no paths, then there is a broken path between nodes A and B. This can be resolved in one of two ways:

Removing path 2 from A
Adding path 6 to B

In this case, it does not matter which way you choose to resolve the conflict, because either way results in 1 node being changed.
This first example can be illustrated as follows (* represents nodes):
Original:
 *- *

 *  *

First method:
 *  *

 *  *

Second method:
 *--*

 *  *

If node A has path 3, B has path 4, C has path 2, and D has no paths, the paths from A to D, B to D, and C to D are all broken. This can be resolved in one of two ways:

Removing path 3 from A, 4 from B, and 2 from C
Adding paths 6, 7, and 0 to D

In this case, adding to node D is the optimal choice, because it results in 1 node being changed rather than 3. It does not matter how many paths get changed when you change a node; the optimal method is determined by how many nodes get changed.
This example can be illustrated as:
Original:
 *  *
  \ |

 *- *

Suboptimal method:
 *  *

 *  *

Optimal method:
 *  *
  \ |
   \|
 *--*

Input
A 2D matrix of bytes, where each bit represents whether that path is present in the node. 7 represents the most significant bit, and 0 the least significant; in other words, the bits are given in the order 76543210.
For example, the first scenario given above would be:
0b00000010 0b00000000
0b00000000 0b00000000

The second scenario given above would be:
0b00000100 0b00001000
0b00000010 0b00000000

You may take in these values as strings in the base of your choice, or integral types with the width of your choice (e.g. if your language supports a byte or char type, you may still use int if you so choose), but include your choice in your answer.
Output
You should either write a function that returns the corrected map or a program that prints it. Your output format should be the same as your input format.
Test Cases
These are just one example of correct output; valid output with the same number of values changed is also accepted.
[[0x04, 0x00], [0x00, 0x00]] -> [[0x04, 0x40], [0x00, 0x00]]

[[0x08, 0x10], [0x04, 0x00]] -> [[0x08, 0x10], [0x04, 0xC1]]

[[0x04, 0x10, 0x00],            [[0x10, 0x10, 0x00],
 [0x01, 0x80, 0x10],         ->  [0x01, 0x09, 0x10],
 [0x00, 0x00, 0x81]]             [0x00, 0x00, 0x81]]

                          Or -> [[0x18, 0x10, 0x00],
                                 [0x01, 0x89, 0x10],
                                 [0x00, 0x00, 0x81]]

The first two test cases are illustrated above. The third test case can be illustrated as:
Original:
 *- *  *
    |
 | \
 *  *  *
       |
      \|
 *  *  *

Solution:
 *  *  *
 |  |
 |  |
 *  *  *
     \ |
      \|
 *  *  *

Another solution:
 *  *  *
 |\ |
 | \|
 *  *  *
     \ |
      \|
 *  *  *

This is code-golf, so the fewest bytes in each language wins.

This challenge will be clearer if you display actual graphs.

@DavidC Done! Let me know if there's anything else I can clarify, or if you need more test cases.

Here is a visualization program I made in Jelly for some odd reason.

@fireflame241 this is cool! I drew these out by hand actually ahaha

Haskell, 655 bytes
u%w=u!!w
r=zip[-1,0,1,1,1,0,-1,-1][-1,-1,-1,0,1,1,1,0]
g _[]_= -1
g i(e:l)x|x==e=i|1>0=g(i+1)l x
l?x=g 0 l x
d _[]_ _=[]
d i(e:l)t v|i==t=v:l|1>0=e:d(i+1)l t v
c=d 0
f n|all(==0).concat.q$n=n|1>0=f$foldr(\p b->s b[k,m]p)n$k!m where
 h=length n-1
 e=mapM(\w->[0..w])[h,h]
 i!j=[[x,y]|[x,y]<-e,x>i-2&&x<i+2&&y>j-2&&y<j+2]
 q o=[[sum[1|[x,y]<-w!l,let
  u=(x-w,y-l)
  p=(w-x,l-y)in u/=p&&('1'==(o%w%l)%(r?u))/=('1'==(o%x%y)%(r?p))]|l<-[0..h]]|w<-[0..h]]
 v[x,y][a,b]|q n%x%y>q n%a%b=[x,y]|1>0=[a,b]
 [k,m]=foldr1 v e
 s w[x,y][a,b]|x==a&&y==b=w|'1'==w%x%y%(r?(a-x,b-y))=z '0'|'1'==w%a%b%(r?(x-a,y-b))=z '1'|1>0=w where z u=c w x$c(w%x)y$c(w%x%y)(r?(a-x,b-y))u

Man... 655 is a lot. I'm sure this isn't the best approach but since no one's answered this challenge yet I figured I would throw something at it.
Input is a list of lists of strings, viz. [[String]] or, equivalently, [[[Char]]]. The string format is "76543210", where the string is a '0' or a '1' in any given position based on whether or not the node points in that corresponding direction. This should conform with the spec:

7 represents the most significant bit, and 0 the least significant; in other words, the bits are given in the order 76543210.

But the examples below that seem to contradict it, instead doing something more like ?7654321, so I'm not sure.
Test suite:
main :: IO ()
main = print $ f
    [ ["00000100", "00010000", "00000000"]
    , ["00000001", "10000000", "00010000"]
    , ["00000000", "00000000", "10000001"]
    ]

(That's the last test case in the spec^)

"7 represents the most significant bit, and 0 the least significant; in other words, the bits are given in the order 76543210."
What I meant by this is the following:
Say you have a node with only path 0 present. Then its binary representation is 0b00000001.
A node with paths 3 and 5 present would have the binary representation 0b00101000.
The test cases are written in hex, but they follow this convention.
Well done! (I would help you golf it more but I don't know Haskell.)

Python3, 497 bytes:
E=enumerate
L=lambda d,x,y:(x+(K:=d not in[6,2])*[1,-1][d%7<2],y+(d%2 or K==0)*[-1,1][d<4])
def f(b):
 q,Z=[([[(x,y),e]for x,j in E(b)for y,e in E(j)],[])],{}
 while q:
  B,T=q.pop(0)
  if[]==(o:=[(Y,b,c)for Y,(a,b)in E(B)if(c:=[(i,K[0])for i,(A,p)in E(B)if(K:=[(I,R)for I in p if L(I,*A)==a and(R:=[I+4,I-4][I+4>7])not in b])])]):Z[len({*T})]=B;continue
  for i,b,c in o:
   for I,(g,h)in c:Q=eval(str(B));W=eval(str(B));Q[i][1]+=[h];W[I][1].remove(g);q+=[(W,T+[I]),(Q,T+[i])]
 return Z[min(Z)]

Try it online!
This is a basic brute force solution. Below, however, is an optimized version, at the cost of 100 bytes:

Python3, 597 bytes:
E=enumerate
L=lambda d,x,y:(x+(K:=d not in[6,2])*[1,-1][d%7<2],y+(d%2 or K==0)*[-1,1][d<4])
def f(b):
 q,Z,X=[([[(x,y),e]for x,j in E(b)for y,e in E(j)],[])],{},[]
 while q:
  B,T=q.pop(0)
  if[]==(o:=[(Y,b,c)for Y,(a,b)in E(B)if(c:=[(i,K[0])for i,(A,p)in E(B)if(K:=[(I,R)for I in p if L(I,*A)==a and(R:=[I+4,I-4][I+4>7])not in b])])]):Z[len({*T})]=B;continue
  if Z and len({*T})>=min(Z):continue
  for i,b,c in o:
   for I,(g,h)in c:
    Q=eval(str(B));W=eval(str(B));Q[i][1]+=[h];W[I][1].remove(g)
    if W not in X:q+=[(W,T+[I])];X+=[W]
    if Q not in X:q+=[(Q,T+[i])];X+[Q]
 return Z[min(Z)]

Try it online!


text:
Tips for golfing in Mini-Flak
What general tips do you have for golfing in Mini-Flak? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Mini-Flak (e.g. "remove comments" is not an answer).
Please post one tip per answer.
Mini-Flak is just Brain-flak without [], <...> or <> so tips for Mini-Flak are different for a large amount of problems. However the use of brackets like [...] are allowed.

I would like to point out that this brain-flak tip becomes a lot more important when writing in mini-flak.  Since it is already a tip on the Brain-flak question I won't make an answer detailing it here, but it is a crucial tip to consider.

Zero efficiently
The <...> from Brain-flak is missing so it is often required that you replace it with something else.
The two following snippets do just that:

(...)[{}]
[(...)]{}

However when you are zeroing it is important to select these properly, because there is a lot of golfing that can be done that can't be done with Brain-Flak's zeros.  For example the following Brain-Flak code:
({}[()]<({}())>)

Could be reconstituted as
({}[()](({}()))[{}])

However it is cheaper to do
({}[()(({}()))]{})

You should try to combine your negative with as many other negatives in the scope as possible.

That is a good tip.

Use "XOR swap"-style swaps to move values around
One of the biggest issues with Mini-Flak's command set is that, having only "two" stacks (the active stack, and the stack of temporary values implied by the structure of the program), you can't move two values past each other with simple copying; if you have value a above b on the primary stack, and want b above a, at some point you'll have to have a stack element that's storing parts of b and a simultaneously.
There's a well known trick in languages like C to swap two values without using a temporary:
a ^= b;  /* now a = a0^b0, b = b0 */
b ^= a;  /* now a = a0^b0, b = a0 */
a ^= b;  /* now a = b0,    b = a0 */

The trick is that you temporarily use a to store a combination of a and b, so that you can use the combined value to transform b into a, and then use the value of a you just obtained to recover b from the combined value.
Less well known is that you can do the same trick with addition and subtraction:
a -= b;  /* now a = a0-b0, b = b0 */
b += a;  /* now a = a0-b0, b = a0 */
a = b-a; /* now a = b0,    b = a0 */

This version of the trick uses only operations that we have available in Brain-Flak, so we can actually write it.
When I wrote it by hand, I eventually golfed it into the following program (which uses a different sequence of additions and subtractions from the example above):
(({}({}))[({}[{}])])

Try it online!
I've also been writing a computer search program to try to optimise Mini-Flak fragments, and tested it on this problem; it confirmed that 20 bytes is the shortest possible swap of the top two stack elements, but found a different way to write the solution, which is probably a bit easier to follow (in addition to matching the algorithm given more closely):
([({}[({})])]({}{}))

Try it online!
Here's how it documented its own version of the program (stacks are written with the active end at the right, and "Working" is the Mini-Flak equivalent of the third stack):
                      [$b, $a]      Working: $W
(                     [$b, $a]      Working: $W, 0
([                    [$b, $a]      Working: $W, 0, 0
([(                   [$b, $a]      Working: $W, 0, 0, 0
([({}                 [$b]          Working: $W, 0, 0, $a
([({}[                [$b]          Working: $W, 0, 0, $a, 0
([({}[(               [$b]          Working: $W, 0, 0, $a, 0, 0
([({}[({}             []            Working: $W, 0, 0, $a, 0, $b
([({}[({})            [$b]          Working: $W, 0, 0, $a, $b
([({}[({})]           [$b]          Working: $W, 0, 0, $a-$b
([({}[({})])          [$b, $a-$b]   Working: $W, 0, $a-$b
([({}[({})])]         [$b, $a-$b]   Working: $W, -$a+$b
([({}[({})])](        [$b, $a-$b]   Working: $W, -$a+$b, 0
([({}[({})])]({}      [$b]          Working: $W, -$a+$b, $a-$b
([({}[({})])]({}{}    []            Working: $W, -$a+$b, $a
([({}[({})])]({}{})   [$a]          Working: $W, $b
([({}[({})])]({}{}))  [$a, $b]      Working: $W+$b

We start by calculating the difference $a-$b, removing $a from the stack in the process but leaving $b there. Then we make two copies of the difference on our working stack, with opposite signs ($a-$b and $b-$a); we can add the $a-$b copy to $b to transform it into $a, and the result of the push $a ends up adding to the $b-$a copy to produce $b, which we can push to the stack on top of the new $a.
The same general idea can be used to do arbitrary stack operations (e.g. copying the fourth stack element into the second position); although the programs are fairly long by the standards of most programming languages, they're not really that long by Mini-Flak standards, and the only other way such a program could be written would be to handle each possible value for the intervening stack elements individually, which would be less general and much more verbose.

The same code you wrote has been known about and is the shortest known in Brain-Flak as well.  Although I don't know if anyone had discovered the one your program found.

@PostLeftGarfHunter: It's the shortest possible, not just the shortest known (assuming that [] and {…} aren't useful in this situation; it's hard to see how they could be). I added in <…> and <> to the brute-forcing and neither of them helped. So this program isn't any different in Brain-Flak and Mini-Flak.

ohh a good one!