extract

How to extract text in php using regex

南笙酒味 提交于 2019-12-05 00:59:00
My Text : 12a49803-713c-4204-a8e6-248e554a352d_ Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: base64 DQrn0Ocg0dPH5MkgyszR6sjqySDl5iDH5OfoyuXq5A0KDQrH5OTaySDH5NnRyOrJIOXP2ejlySAx MDAlDQogCQkgCSAgIAkJICA= --_12a49803-713c-4204-a8e6-248e554a352d_ Content-Type: text/html; charset="iso-8859-6" Content-Transfer-Encoding: base64 PGh0bWw+DQo8aGVhZD4NCjxzdHlsZT48IS0tDQouaG1tZXNzYWdlIFANCnsNCm1hcmdpbjowcHg7 I want to extract iso-8859-6 you could do: preg_match('/charset="([^"]+)"/',$string,$m); echo $m[1]; Edit: In case all need matching (prompted from other answer) modify

Extracting part of a string to a variable in bash

柔情痞子 提交于 2019-12-05 00:56:10
noob here, sorry if a repost. I am extracting a string from a file, and end up with a line, something like: abcdefg:12345:67890:abcde:12345:abcde Let's say it's in a variable named testString the length of the values between the colons is not constant, but I want to save the number, as a string is fine, to a variable, between the 2nd and 3rd colons. so in this case I'd end up with my new variable, let's call it extractedNum, being 67890 . I assume I have to use sed but have never used it and trying to get my head around it... Can anyone help? Cheers On a side-note, I am using find to extract

Replacing one character with another in a string

房东的猫 提交于 2019-12-04 22:32:37
I have a data like below: A:B:C:D and I want to replace the C with data (say, Z ) so that it may look like A:B:Z:D How can I do it? =SUBSTITUTE(A1,"C","Z") Although I wasn't clear on whether you wanted G or Z , you mentioned G but your example output shows Z . jrad If you have A:B:C:D in cell A1, then this works: =CONCATENATE(MID(A1, 1, SEARCH(":", MID(A1, SEARCH(":", A1) + 1, LEN(A1) - SEARCH(":", A1) + 1)) + SEARCH(":", A1)), "Z", MID(MID(MID(A1, SEARCH(":", A1) + 1, LEN(A1) - SEARCH(":", A1) + 1), SEARCH(":", MID(A1, SEARCH(":", A1) + 1, LEN(A1) - SEARCH(":", A1) + 1)) + 1, LEN(MID(A1,

How to extract data from a file in C

倖福魔咒の 提交于 2019-12-04 21:26:41
I have a .dat file containing 6 columns of N numbers like so: -4.997740e-01 -1.164187e+00 3.838383e-01 6.395961e+01 -1.938013e+02 -4.310365e-02 -1.822405e+00 4.470735e-01 -2.691410e-01 -8.528020e+01 -1.358874e+02 -7.072167e-01 9.932887e-01 -2.157249e+00 -2.303825e+00 -5.508925e+01 -3.548236e+02 1.250405e+00 -1.871123e+00 1.505421e-01 -6.550555e-01 -3.254452e+02 -5.501001e+01 8.776851e-01 1.370605e+00 -1.028076e+00 -1.137059e+00 6.096598e+01 -4.472264e+02 -1.268752e+00 ............ ............ ............ ............ ........... ........... I want to write a code in C language where I

How to extract a part of a matrix with condition in Matlab

孤街醉人 提交于 2019-12-04 20:41:51
I have a sat of matrices and I want to extract only a part of the matrix that satisfy a condition. For example: values of the 150x180 matrix goes from 0 to 2.80 and I only want those between 1.66 and 1.77 I want to keep the values within the rang in their original location in the original matrix and set the other to zero. can anybody help me please. Thank you You can use logical indexing. First, find A entries that do not satisfy your conditions. Next, using A(idx) change them to 0: % example matrix A = 2.8*rand(150, 180); % find entries meeting some criterion idx = A<1.66 | A>1.77; A(idx) = 0

Python zipfile.extract() doesn't extract all files

ぃ、小莉子 提交于 2019-12-04 19:13:14
问题 I'm trying to extract zipped folder using code found here. def unzip(source_filename, dest_dir): with zipfile.ZipFile(source_filename) as zf: for member in zf.infolist(): words = member.filename.split('/') path = dest_dir for word in words[:-1]: drive, word = os.path.splitdrive(word) head, word = os.path.split(word) if word in (os.curdir, os.pardir, ''): continue path = os.path.join(path, word) zf.extract(member, path) But when trying to extract, for example, wordpress.zip with directory

Extract hash tag from String [closed]

瘦欲@ 提交于 2019-12-04 19:10:28
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I want to extract any words immediately after the # character in a String , and store them in a String[] array. For example, if this is my String ... "Array is the most #important thing in any programming #language" Then I want to extract the following words into a String[] array.

extract title tag from html

让人想犯罪 __ 提交于 2019-12-04 16:32:12
I want to extract contents of title tag from html string. I have done some search but so far i am not able to find such code in VB/C# or PHP. Also this should work with both upper and lower case tags e.g. should work with both <title></title> and < TITLE></TITLE> . Thank you. You can use regular expressions for this but it's not completely error-proof. It'll do if you just want something simple though (in PHP): function get_title($html) { return preg_match('!<title>(.*?)</title>!i', $html, $matches) ? $matches[1] : ''; } Sounds like a job for a regular expression. This will depend on the HTML

How to extract bold and non-bold text from pdf using R

我的梦境 提交于 2019-12-04 16:09:44
I am using R for extracting text. The code below works well to extract the non-bold text from pdf but it ignores the bold part. Is there a way to extract both bold and non-bold text? news <-'http://www.frbe-kbsb.be/sites/manager/ICN/14-15/ind01.pdf' library(pdftools) library(tesseract) library(tiff) info <- pdf_info(news) numberOfPageInPdf <- as.numeric(info[2]) numberOfPageInPdf for (i in 1:numberOfPageInPdf){ bitmap <- pdf_render_page(news, page=i, dpi = 300, numeric = TRUE) file_name <- paste0("page", i, ".tiff") file_tiff <- tiff::writeTIFF(bitmap, file_name) out <- ocr(file_name) file_txt

Extract text from PDF in code

拥有回忆 提交于 2019-12-04 15:14:17
I'm making an app for my school which people can check with if they've got a schedule change. All schedule changes are listed here: http://www.augustinianum.eu/roosterwijzigingen/14062012.pdf . I want to search that page for a keyword (the user's group, which is entered in an EditText). I've found out how to make the app check if the edittext matches a certain string, so now I only need to download all of the text on that page to a string. But the problem is that it's not a simple webpage, but a PDFpage. I've heard that you need a special pdf library or something to extract the text from the