I
I
Ilya2016-03-21 00:08:32
Python
Ilya, 2016-03-21 00:08:32

How to find a word using regular expressions?

How to use regular expressions to find the word album, and remove everything before it. and the very word.
re.sub("[\bum\w+]*",''
I tried this, and in different ways, it does not work.
The link is like this.
https://vk.com/album

Answer the question

In order to leave comments, you need to log in

8 answer(s)
I
iegor, 2016-03-21
@nuBacuk

The pattern is - '.*album'
Learn regex - https://docs.python.org/3.5/library/re.html

S
Swartalf, 2016-03-21
@Swartalf

"The task is to cut the link, of this form
https://m.vk.com/album-39243732_221039994 "
Try this condition:
(?<=.album-).*
It is convenient to check here https://regex101.com/

M
Max Payne, 2015-01-23
@id1cc

When logging in through a social network using oAuth, it (the social network) will usually give at least a user ID, but, for example, you can also request a token in the vk api, with which you can get more detailed information about the user (of course, by requesting permission access to this information). Then you just save the registration data that the user entered in your database along with the identifier from the social network, and when you enter the site, check if there is such an entry in the database.
FB: https://developers.facebook.com/docs/reference/dia...
Twitter: https://dev.twitter.com/oauth/reference/post/oauth... and https://dev.twitter .com/oauth/application-only
Google: https://developers.google.com/accounts/docs/OAuth2
Google even has an example on github for puff: https://github.com/google/google-api-php-client

D
Dmitry Entelis, 2015-01-23
@DmitriyEntelis

https://vk.com/dev/sites

A
Anton Shamanov, 2015-01-23
@SilenceOfWinter

https://ru.wikipedia.org/wiki/OAuth is possible, v1, but v2 is better

I
IceJOKER, 2015-01-23
@IceJOKER

Quick ways:
loginza.ru
ulogin.ru
^^^
Yes, and it’s easy to integrate, but if you yourself want, then you won’t get by with two words, read the mana / api for each social network and implement

D
Dmitry, 2015-01-23
@thewind

To be honest, there are plenty of guides on the Internet for each network. Only on Twitter it is perhaps difficult to find an up-to-date example, because everywhere there is info on their outdated methods.
In fact, after all the oAuth operations and getting the token, the network gives you the user_id, and then you check if it is in your table. If not, insert a line and it will be registration. If it was, then do your authorization with the found string. Everything.

I
id1cc, 2015-01-23
@id1cc

Thank you all, I figured it out with VK. Now we need manuals for facebook, twitter and google plus (never worked with them).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question