Are there any string matching languages besides regex?

are there any string matching languages besides regex?

Other urls found in this thread:

en.wikipedia.org/wiki/Formal_language
en.wikipedia.org/wiki/File:Chomsky-hierarchy.svg
lambda-the-ultimate.org/node/3039
twitter.com/NSFWRedditGif

Any language can be used to match strings.

>are there any string matching languages besides regex?
What?

I mean languages for pattern matching specifically. Regex is tailored at pattern matching and does this well but not much else; are there any others like that?

perl

glob?

perl regex are still regex

they are regex extensions, it's pretty much like C vs C++

sed and awk
grep can be used for pattern matching, but it's not a language.

lua's patterns are similar but less powerful

yess but it's pretty limited

all three use regex senpai

en.wikipedia.org/wiki/Formal_language

Well shit then. idk.

never seen this one…looks a lot like regex with \ replaced with % which honestly isn't a bad decision

So far:
* glob
* lua patterns
* Backus–Naur?

>3 things which use regex are a replacement for regex

user....

wolfram patterns
more info

recursive pattern matching or just simple 1:1 matching?

I do not think you can get much better than regular expressions for the finite automata-matching

checked. all of 'em

ideal would be a backus-naur–equivalent that is as dense as regex?

g/re/p

global / regular expression / print

Read a book you fucking idiot

gosh, you guys
does denigrating others' knowledge make you feel more secure in your own?

backus naur is regex though?

just several separate statements of increasing/decreasing complexity

Is it retarded to use regex to parse command strings on a server ?

I have multiple clients sending bash like commands and I have a regex pattern used to match and extract parameters.

Will regex cause speed issues somehow ? The pattern is bretty solid btw and I havent been having trouble sending large commands yet.

Hey I'm not the dumbass searching for something different just to be different when everything uses regular expressions. Get fucked.

F# is great for quick and dirty recursive parsers using pattern matching and active patterns. Works every time, no matter your data format.

Perl is nice too.

en.wikipedia.org/wiki/File:Chomsky-hierarchy.svg
recursively enumerable ⊃ context-sensitive ⊃ context-free ⊃ regular

regex are regular, backus-naur are context free
but I think perl regex exceed the regular class

if you only use basic regex and no extended/perl ones you shouldn't have any problems
see

It's not that bad, but you should consider processing messages on client side and sending less complicated commands to server.

I'm not sure what you have in mind but maybe look into Parsing Expression Grammars?

lambda-the-ultimate.org/node/3039

I basically wanted a way to send any type of data through strings so I just parse straight from text , I dont know how the data could be processed any further client side considering I only send things like integers and other strings.

I really cant think of any better way to send data through server. Clients can send requests for small pieces of data or the entire set of server side variables and the server replies with the data asked. I just hate doing this through strings.

>He sends integers as a string

I see

If the BNF had an ordering of statements where the lower statements only referred to statements below it, not above it -- would it be implementable as a regex?

maybe would know

Tell me why thats retarded honeslty I cant figure out the best way to send data between server and client that isnt jamming everything in a string and extracting the parameters by parsing.

I send the entire set of variables as a string. The server only receives and sends strings so you can send them manually if you need to. I just think its retarded to send individual integers if im going to be sending the whole byte array from the string ?

At this point what the hell should I even do ? I dont want to have to play with bitshifts just to send data from client to server.

consider using json?

Parsing strings with regex for arguments seems like it could be a huge disaster with injections if users type the stuff you search for as their text arguments

for reference:

$ cat > main.c

>indentation
#include
#include
#include

int main(void)
{
FILE *bin, *txt;
int i;

bin = fopen("binary", "wb");
txt = fopen("text", "w");

for (i = 0; i < 65535; i++) {
#define BUFSZ 12
char buf[BUFSZ];
int r = rand();

fwrite(&r, sizeof(r), 1, bin);
snprintf(buf, BUFSZ, "%d\n", r);
fwrite(buf, 1, strlen(buf), txt);
}

return 0;
}

well looks like ideographic spaces no longer work
still never gonna use code tags

[ code ]

[ /code ]

Regular expressions isn't a language you fucking 12 year old.

honestly had not considered json, but considering how I use the data I dont think code injections are a big problem.

The problem is still users sending data as another user by spoofing their name parameter.

desu am total noob at servers , this is the first server app I got working except a few basic chat clients. This shit is messing with my mind.

you are literally describing data serializing, which can be done with xml or json with built in libraries.

except i just send small bits of data in commands and sending a , I doubt I need this when sending commands. Perhaps for data requests json could be nice , but then again I dont need a whole framwork around the data.

*a small bit of text using json would be retarded

Writing a Parsec/Megaparsec parser is really easy

Lol. Comp Sci much?

Nice email validation Regex, OP.

Yes. PEGs are vastly superior to regex.

Regex is a concept. Any string matching probably falls under the regex umbrella

>Any string matching

No, PEGs are context-free iirc.

Also, wouldn't all lexers fall under "string matching"?

grok

Not sure what Mathematica uses for its pattern recognition. It's C under the hood so probably just something standard. If you count the Wolfram language as it's own thing it's not regex though.

/^((?:(?:[^?+*{}()[\]\\|]+|\\.|\[(?:\^?\\.|\^[^\\]|[^\\^])(?:[^\]\\]+|\\.)*\]|\((?:\?[:=!]|\?)?(?1)??\)|\(\?(?:R|[+-]?\d+)\))(?:(?:[?+*]|\{\d+(?:,\d*)?\})[?+]?)?|\|)*)$/

Recursive Regex that checks for valid Regex (but not OTHER meta-regex like this one, only normal baseline complexity). Requires Perl or PCRE.

Doing pattern matching in ICON is neat. Would recommend.

>ICON

my nigga.