-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (36 loc) · 1.17 KB
/
index.js
1
2
3
4
5
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
55
56
const { log } = require('console');
const fs = require('fs');
const pdf = require('pdf-parse');
let dataBuffer = fs.readFileSync('./Ritin-George-Resume.pdf');
const pdfText = "helo ther my name is Ferwin and I am from Mar Baselios College Of Engineering and Technology";
// Regular expression to match and capture the college name
const collegeRegex = /from\s(.+?)(\s|$)/i;
const match = pdfText.match(collegeRegex);
if (match && match[1]) {
const collegeName = match[1].trim();
console.log("College Name:", collegeName);
} else {
console.log("College name not found in the text.");
}
// pdf(dataBuffer).then(function(data) {
// const extractData = data.text.split('\n');
// let name;
// for(let i =0;i<extractData.length;i++){
// if(extractData[i] != ""){
// console.log("Name :"+extractData[i]);
// name = extractData[i];
// break;
// }
// }
// const emailRegex = /\S+@\S+.\S+/;
// let emailArr;
// for(let i =0;i<extractData.length;i++){
// if(extractData[i]){
// emailArr = extractData[i].toLowerCase().match(emailRegex);
// }
// }
// console.log(emailArr);
// })
// .catch(function(error){
// console.log(error);
// })